Good morning everyone,
One of my servers is set up as follows:
I want to use the machine not only as a web /email server, but also as a git repository for our development work, with access provided over HTTPS rather than SSH, as it's currently underutilised (though feel free to argue that I should set up users for SSH connections instead).
(I've anonymised the username, that is the primary intended host, to be "userhere")
To that end, using:
Software » Install an RPM
I've installed git (all, version 2.2.0).
Through SSH I've added a symbolic links to make git and git-http-backend available to the users:
I've (among others) got a test bare git repository:
I've set up:
Service Configuration » Apache Configuration » Include Editor
Post VirtualHost Include
as:
(You can see some rather desperate additions of indexes where I'm trying to work out just where the problem is)
I've copied gitweb.cgi from its home to the aforementioned directory, and set it up with the correct variables, eg: our $projectroot = "/home/userhere/securearea/gitrepositories";
The cgi access to gitweb.cgi works just fine, but I simply cannot clone the repositories I have hosted. From my local machine I've tried:
Which reports a 500 server error, where the Apache error logs show the following:
"GET /git/testgitrepo/info/refs?service=git-upload-pack HTTP/1.1" 404 - "-" "git/1.9.5.msysgit.0"
So 404 or 500? Well to be fair /testgitrepo/info/refs doesn't exist, but then ScriptAliasMatch should be turning that into:
/usr/local/libexec/git-core/git-http-backend/testgitrepo/info/refs?service=git-upload-pack
For reference, I have made sure that this isn't being caused by conflicting ScriptAlias and ScriptAliasMatch, by changing the ScriptAlias to work (again successfully) under a different directory match. I've also tried a straight ScriptAlias /git/ /usr/local/libexec/git-core/git-http-backend/ to remove the RegEx from the equation.
Please could anyone advise me where I might be going wrong?
Once this is set up, there's still the security to add, which I'm sure will be a breeze once this is working!
B
One of my servers is set up as follows:
- CENTOS 6.6 x86_64 standard
- WHM 11.46.2 (build 4)
- Apache 2.4 (including mod_env)
- PHP 5.5
I want to use the machine not only as a web /email server, but also as a git repository for our development work, with access provided over HTTPS rather than SSH, as it's currently underutilised (though feel free to argue that I should set up users for SSH connections instead).
(I've anonymised the username, that is the primary intended host, to be "userhere")
To that end, using:
Software » Install an RPM
I've installed git (all, version 2.2.0).
Through SSH I've added a symbolic links to make git and git-http-backend available to the users:
Code:
ln -s /usr/local/cpanel/3rdparty/bin/git /usr/local/bin/git
ln -s /usr/local/cpanel/3rdparty/libexec/git-core /usr/local/libexec/git-core
Code:
cd /home/userhere/securearea/gitrepositories
mkdir testgitrepo
cd testgitrepo
git --bare init
Service Configuration » Apache Configuration » Include Editor
Post VirtualHost Include
as:
Code:
SetEnv GIT_PROJECT_ROOT /home/userhere/securearea/gitrepositories
SetEnv GIT_HTTP_EXPORT_ALL
SetEnv REMOTE_USER $REDIRECT_REMOTE_USER
<Directory /usr/local/libexec/git-core>
Options ExecCGI Indexes
Order allow,deny
Allow from all
</Directory>
ScriptAliasMatch "^/git/(.*/(HEAD|info/refs|objects/(info/[^/]+|[0-9a-f]{2}/[0-9a-f]{38}|pack/pack-[0-9a-f]{40}\.(pack|idx))|git-(upload|receive)-pack))$" /usr/local/libexec/git-core/git-http-backend/$1
ScriptAlias /git/ /home/userhere/public_html/cgi-bin/gitweb.cgi/
<Directory "/home/userhere/securearea/gitrepositories">
Options Indexes
Order allow,deny
Allow from all
</Directory>
(You can see some rather desperate additions of indexes where I'm trying to work out just where the problem is)
I've copied gitweb.cgi from its home to the aforementioned directory, and set it up with the correct variables, eg: our $projectroot = "/home/userhere/securearea/gitrepositories";
The cgi access to gitweb.cgi works just fine, but I simply cannot clone the repositories I have hosted. From my local machine I've tried:
Code:
git clone https://myserver/git/testgitrepo/
"GET /git/testgitrepo/info/refs?service=git-upload-pack HTTP/1.1" 404 - "-" "git/1.9.5.msysgit.0"
So 404 or 500? Well to be fair /testgitrepo/info/refs doesn't exist, but then ScriptAliasMatch should be turning that into:
/usr/local/libexec/git-core/git-http-backend/testgitrepo/info/refs?service=git-upload-pack
For reference, I have made sure that this isn't being caused by conflicting ScriptAlias and ScriptAliasMatch, by changing the ScriptAlias to work (again successfully) under a different directory match. I've also tried a straight ScriptAlias /git/ /usr/local/libexec/git-core/git-http-backend/ to remove the RegEx from the equation.
Please could anyone advise me where I might be going wrong?
Once this is set up, there's still the security to add, which I'm sure will be a breeze once this is working!
B