Skip to content

Instantly share code, notes, and snippets.

Created October 28, 2010 20:31
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save anonymous/652266 to your computer and use it in GitHub Desktop.
git-http-backend.cgi:
#!/bin/bash
GIT_PROJECT_ROOT=/home/sshconnectiongit/git
PATH_INFO=$SCRIPT_URL
echo $PATH_INFO >> test.txt
/usr/lib/git-core/git-http-backend
.htaccess:
Options +ExecCgi
AuthName "Private Git Access"
AuthType Basic
#you need to add users and passwords to the .htpasswd file
#you have to add the same user and password on the client machine under ~/.netrc
AuthUserFile /home/sshconnectiongit/git.sshconnection.com/.htpasswd
Require valid-user
RewriteEngine on
#RewriteBase /git
SetHandler cgi-script
#RewriteRule ^([a-zA-Z0-9._]*\.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))$ /git/git-http-backend.cgi/$1
RewriteCond %{REQUEST_URI} ^(.*/(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))$
RewriteRule (.*) git-http-backend.cgi/ [L,E=SCRIPT_URL:/$1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment