1

I'm trying to configure my own private git server to make it available over HTTP, but I'm stuck and I need some help.

I reviewed several tutorials on how to serve a git repository over HTTP and I think almost all the pieces are in the right places as currently I'm able to clone the remote repository from several clients on different workstations and I can also browse the repositories with the gitweb application.

From the clients I'm able to run the git commit command, but I'm not able to push the changes to the master branch.

The git push comman logs the following error:

remote: error: unable to create temporary file: Operation not permitted
remote: fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit

Update: after several tests, I managed to push four times from several clients running. The successfull push happened just repeating several times the execution of the same command. This lead me to believe that the problem might be on some overloading trouble on the server side that is not allowing to receive the changes, but I'm still not able to understand which configuration is missing.

The environment is as below:

$ uname -av
Linux odroid 3.8.13.30 #1 SMP PREEMPT Fri Feb 20 14:34:08 BRST 2015 armv7l armv7l armv7l GNU/Linux

$ apache2 -version
Server version: Apache/2.4.7 (Ubuntu)
Server built:   Jan 14 2016 17:49:32

$ git --version
git version 1.9.1

The permission should not be an issue as the repositories folders have rw permission for the group that is running the apache service

$ ls /var/git/repos
drwxrwx--- 0 odroid www-data 0 may 28 23:15 testremote.git
drwxrwx--- 0 odroid www-data 0 may 28 23:17 test

$ ps aux | grep apache
root      4524  0.0  0.8 107588 17836 ?        Ss   may25   0:17 /usr/sbin/apache2 -k restart
www-data  7797  0.0  0.4 107836  8372 ?        S    00:35   0:00 /usr/sbin/apache2 -k restart
www-data  7798  0.0  0.3 107636  7392 ?        S    00:35   0:00 /usr/sbin/apache2 -k restart
www-data  7799  0.0  0.4 107836  8300 ?        S    00:35   0:00 /usr/sbin/apache2 -k restart
www-data  7800  0.0  0.3 107692  7916 ?        S    00:35   0:00 /usr/sbin/apache2 -k restart
www-data  7801  0.0  0.3 107636  7392 ?        S    00:35   0:00 /usr/sbin/apache2 -k restart
www-data  7812  0.0  0.3 107636  7404 ?        S    00:35   0:00 /usr/sbin/apache2 -k restart

My current apache configuration is:

            SetEnv GIT_PROJECT_ROOT /mnt/wh13/sandbox/git/repo/
            SetEnv GIT_HTTP_EXPORT_ALL 1
            SetEnv REMOTE_USER $REDIRECT_REMOTE_USER
            ScriptAliasMatch "(?x)^/git/\
                     (.*\.git/(HEAD|info/refs|objects/\
                     (info/[^/]+|[0-9a-f]{40}\.(pack|idx))|git-(upload|receive)-pack))$"\
                      /usr/lib/git-core/git-http-backend/$1

            ScriptAlias /git/ /usr/share/gitweb/
            ScriptLog ${APACHE_LOG_DIR}/cgi_log.log
            <Directory /usr/share/gitweb>
               Options +FollowSymLinks +ExecCGI
               AddHandler cgi-script .cgi
               DirectoryIndex gitweb.cgi
            </Directory>
            <Directory "/usr/lib/git-core*">
               Options ExecCGI Indexes
               AuthType Basic
               AuthName "GIT Repositories"
               AuthUserFile /mnt/wh13/sandbox/git/htpasswd.git
               Require valid-user
               Order allow,deny
               Allow from all
            </Directory>
            <Directory "/usr/share/gitweb/static">
               Options -ExecCGI +Indexes
               SetHandler default-handler
            </Directory>

I'm not understanding which operation is not permitted and also trying to get more details from the CGI script using the ScriptLog ${APACHE_LOG_DIR}/cgi_log.log directive didn't provide any useful information.

Can anybody please provide some suggestion on how to further troubleshoot and fix the problem?

Thanks in advance and sorry for the long post

Ugo Delle Donne
  • 183
  • 1
  • 6
  • It seems the error is at the remote side. Try to push to a local git repo. `mkdir tmp;cd tmp;git init --bare`, and then go to your repo and run `git push tmp/ HEAD:master`. If it's okay locally, I'm afraid maybe you have no permission to write at the server. – ElpieKay May 29 '16 at 01:00
  • Hi ElpieKay, I'm not sure where I should run the command above, but I agree that the error must be somewhere on the server side. It happens also when trying to push changes to the remote repository from the server that hosts it using the same user that owns the repositories. What I'm having trouble to understand is how can I get some more details on which operation in not permitted. – Ugo Delle Donne May 29 '16 at 09:25

1 Answers1

0

Git 2.21 (Q1 2019) might prove more robust when encountering those errors.

The http-backend CGI process did not correctly clean up the child processes it spawns to run upload-pack etc. when it dies itself, which has been corrected.

See commit 02818a9 (24 Nov 2018) by Max Kirillov (max630).
Helped-by: Carlo Arenas (carlosJoseloMtz).
(Merged by Junio C Hamano -- gitster -- in commit ea8620b, 04 Jan 2019)

http-backend: enable cleaning up forked upload/receive-pack on exit

If http-backend dies because of errors, started upload-pack or receive-pack are not killed and waited, but rather stay running for some time until they exit because of closed stdin.

It may be undesirable in working environment, and it also causes occasional failure of t5562, because the processes keep opened act.err, and sometimes write there errors after next test started using the file.

Fix by enabling cleaning of the command at http-backend exit.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250