I am trying to setup a git server behind apache 2.4 but could´t get it to work. I tried following all the tips I found here but didn´t find a working configuration for linux. I did find a working configuration for windows but when I tried to adapt it, it still fails.
The idea is to access the repositories from https://example.com/git/test.git
This is the part of my apache2.conf relevant to my git configuration:
<Directory "/var/www/kh_webserver/git">
AuthType Basic
AuthName "Git Repository"
AuthUserFile /etc/apache2/git.passwds
Require valid-user
</Directory>
SetEnv GIT_PROJECT_ROOT /var/www/kh_webserver/git
SetEnv GIT_HTTP_EXPORT_ALL true
SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
ScriptAliasMatch \
"(?x)^/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/lib/git-core/git-http-backend/$1"
<LocationMatch "^/git/.*/git-receive-pack$">
Options +ExecCGI
AuthType Basic
AuthName "Restricted Access"
AuthUserFile /etc/apache2/git.passwds
Require valid-user
</LocationMatch>
<LocationMatch "^/git/.*/git-upload-pack$">
Options +ExecCGI
AuthType Basic
AuthName "Restricted Access"
AuthUserFile /etc/apache2/git.passwds
Require valid-user
</LocationMatch>
Can somebody point me out where I am going wrong here? Thanks
My root directory in the web server is /var/www/kh_webserver and I have the git repositories (for example test.git) in /var/www/kh_webserver/git
I know this is an old post but you might want to see an entry I wrote on my Wiki about how to do this.
http://wiki.flat.cl/index.php?title=Git,_Apache_and_HTTPS_with_a_free_certificate
Hope it helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.