My setup
- OS: debian
- git: v 1.7.10
- apache (with suexec mode enabled) configuration with git-http-backend and LDAP authorization to git repos which works for clone operations, but not working for push and that's the problem. I use HTTPS as communication protocol to my git server.
Here's my config:
VirtualHost config:
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
DocumentRoot /git/myrepos
<Directory "/git/myrepos">
Allow from All
Options +ExecCGI
AllowOverride All
</Directory>
ScriptAlias /git /git/myrepos/bin/suexec-wrapper.sh
SSLEngine on
SSLCertificateFile /etc/ssl/git.crt
SSLCertificateKeyFile /etc/ssl/git.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
/git/myrepos/bin/suexec-wrapper.sh:
#!/bin/bash
PATH_INFO=$SCRIPT_URL
GIT_PROJECT_ROOT=/git/myrepos
REMOTE_USER=$REDIRECT_REMOTE_USER
export GIT_HTTP_EXPORT_ALL=true
/usr/lib/git-core/git-http-backend
Cloning repos works as it should (eg. git clone https://192.168.0.1/repo1.git
). It accept credentials for ldap user and clone the repo.
And when pushing repo (eg. git push origin master
), it ask for credentials, accept them and then throws error:
error: Cannot access URL https://192.168.0.1/repo1.git/, return code 22
fatal: git-http-push failed
When running push in verbose mode (GIT_CURL_VERBOSE=1 git push origin master
), it ask for credentials, accept them and (tail of output):
* STATE: DO => DO_DONE handle 0x1cdd270; (connection #0)
* STATE: DO_DONE => WAITPERFORM handle 0x1cdd270; (connection #0)
* STATE: WAITPERFORM => PERFORM handle 0x1cdd270; (connection #0)
* additional stuff not fine transfer.c:1037: 0 0
* The requested URL returned error: 401
* Closing connection #0
* Expire cleared
error: Cannot access URL https://192.168.0.1/repo1.git/, return code 22
fatal: git-http-push failed
- Am I configuring apache git-http-backend (with wrap script?) properly?
- And what can cause the problem with push operation?
- How to debug it more detailed way?
Any suggestions very appreciated!
After many tries I've found the solution. The problem was in incorrect VirtualHost configuration for git-http-backend.
Here's my working config:
Now all git operations works properly with git-http-backend via https with ldap authorization :)
Maybe it will be useful for someone.