I was trying to commit something to my Indefero project management server today and was getting the following error:
fatal: bad argument
fatal: The remote end hung up unexpectedly
I puzzled around for a while and then tried manually logging into the git server using a console SSH and was greeted with this:
$ ssh mygitserver.com
PTY allocation request failed on channel 0
PHP Deprecated: Comments starting with ‘#’ are deprecated in /etc/php5/cli/conf.d/mhash.ini on line 1 in Unknown on line 0
PHP Deprecated: Comments starting with ‘#’ are deprecated in /etc/php5/cli/conf.d/ming.ini on line 1 in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php5/20090626+lfs/mhash.so’ – /usr/lib/php5/20090626+lfs/mhash.so: cannot open shared object file: No such file or directory in Unknown on line 0
Need SSH_ORIGINAL_COMMAND in environment.
Connection to mygitserver.com closed.
Those PHP errors are probably throwing Git off course and making it unhappy. The solution was two step:
- Edit /etc/php5/cli/conf.d/ming.ini to ensure that comments are pre-ceded by ‘;’ and not ‘#’
- Move mhash.ini out of /etc/php5/cli/conf.d/ as as it is no longer used in debian (see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593266)
Doing the above two steps resulted in a clean session opening up when ssh’ing into the git server:
$ ssh mygitserver.com
PTY allocation request failed on channel 0
Need SSH_ORIGINAL_COMMAND in environment.
Connection to mygitserver.com closed.
Now pushing to the Git server works – yay!