Reported by Sindre Myren, Apr 19, 2009
Hi. When I try to do git pull/push/clone on my git repository managed by indefero, I get this error: $ git pull origin Need SSH_ORIGINAL_COMMAND in environment. fatal: The remote end hung up unexpectedly My indifero is up to date per 10:02pm Saturday (GMT) My indefero server runs archlinux Any help or insight in what might have caused this problem would be very helpful. Is there perhapse some forced command I can run myself to try and fix this?
Comment 1 by Sindre Myren, Apr 19, 2009
At least SSH_ORIGINAL_COMMAND actually seems to be set. This is what I have done so far in hope of retrieving some useful information: 1) Adding this script as a ForcedCommand for the git user in /etc/ssh/sshd_conf: #!/bin/bash export SSH_SESSION=1 if [ -z "$SSH_ORIGINAL_COMMAND" ] ; then export SSH_LOGIN= echo "Error: Login to this account is not permitted!" else export SSH_LOGIN= [ -r /etc/profile ] && source /etc/profile [ -r ~/.profile ] && source ~/.profile echo Your command was: $SSH_ORIGINAL_COMMAND fi 2) On the command line of my laptop, i run the command: $ ssh email@example.com hello Your command was: hello
Comment 2 by Sindre Myren, Apr 19, 2009
Also the python script (gitserve.py), are able to read SSH_ORIGINAL_COMMAND 1) So, i remove the ForcedCommand from the config file, and add an extra line to /home/www/indefero/scripts: sys.stderr.write("DEBUG: Your command was: %s\n" % os.environ["SSH_ORIGINAL_COMMAND"]) So that the code looks like this: /gitserve.py:n = len("/gitserve.py") GITSERVEPHP = '%s/gitserve.php' % traceback.extract_stack(limit=1)[0:-n] status, output = commands.getstatusoutput('php %s %s' % (GITSERVEPHP, sys.argv)) if status == 0: os.execvp('git', ['git', 'shell', '-c', output.strip()]) else: sys.stderr.write("DEBUG: Your command was: %s\n" % os.environ["SSH_ORIGINAL_COMMAND"]) sys.stderr.write("%s\n" % output) sys.exit(1) 2)I then return to my laptop, and executes the command: $ git pull origin master DEBUG: Your command was: git-upload-pack 'repos/test-private.git' Need SSH_ORIGINAL_COMMAND in environment. fatal: The remote end hung up unexpectedly
Comment 3 by Sindre Myren, Apr 19, 2009
progress.. I figured out that if i replaced '$_ENV' with '$_SERVER' in scripts/gitserve.php, thins started to work. Almost... Also, I had do set the ..._git_home_dir in the config file, as my git home was not /home/git but /srv/git (which was not documented). When I that was done, I got a new error: $ git pull Repository read access denied. fatal: The remote end hung up unexpectedly This happen despite that the user in question has his public ssh key commited, and that he is a member of the project in question.
Comment 4 by Sindre Myren, Apr 19, 2009
(solved) Ok. setting the last variable idf_plugin_syncgit_base_repositories solved my problem. But as mentioned earlier, $_ENV had to be replaces with $_SERVER for everything to work for me.
Comment 5 by Loïc d'Anterroches, Apr 19, 2009
waouh! This is one of the best bug report I have ever read, with detailed steps etc. I will merge $_SERVER and $_ENV to be sure the data are there.
Comment 6 by Loïc d'Anterroches, Apr 19, 2009
Fixed in commit 2b87437, thanks a lot. If you are ok, I will add you to the list of the contributors as your bug reports have helped the fast fixing of critical issues.
Comment 7 by Brenda Wallace, Jun 10, 2010
I just hit this bug too -- i don't think you pushed it to the master branch on git://projects.ceondo.com/indefero.git yet. I solved it using git cherry-pick 2b8743727a35397be5dbbc12a537562c0d85041d
Comment 8 by Thomas Keller, Nov 25, 2010