# [SOLVED] ssh + gitosis, missing SSH_ORIGINAL_COMMAND in env.

## krisse

I've got gitosis-gentoo-0.2_p20080203 installed; together with openssh-5.1_p1-r1.

Everything was working well with the previous version of openssh (4.7_p1-r6), but upgrading to the version mentioned above, I can't ssh in as user git. The error reported is: 

```
PTY allocation request failed on channel 0

ERROR:gitosis.serve.main:Need SSH_ORIGINAL_COMMAND in environment.

Connection to localhost closed.
```

Same result regardless if I'm ssh'ing from local comp. or remote. The ssh login as such succeeds, but then connection is terminated because, I think, gitosis fails. 

I'm assuming the important bit here is SSH_ORIGINAL_COMMAND. It's not among set variables (ie echoing it returns nothing). I don't know if gitosis expects ssh itself to set the variable, or if gitosis tries to set it but fails. Do you have any ideas?Last edited by krisse on Sat Dec 06, 2008 10:11 am; edited 1 time in total

----------

## Hu

Based on the error message, I suspect that gitosis on the client is adding the environment variable SSH_ORIGINAL_COMMAND, but ssh is no longer passing that environment variable to the server.  According to the man page shipped with =net-misc/openssh-5.1_p1-r1, the default is not to send any environment data.  However, the man page shipped with =net-misc/openssh-4.7_p1-r1 says the same thing, so I am not sure why it recently broke.

I recommend using dev-util/strace to determine whether gitosis is passing the environment variable to ssh.  If it is, you may need to configure the SendEnv directive on the client and the AcceptEnv directive on the server to allow this value to propagate correctly.  The sshd_config manpage notes that some variables could be used to bypass restrictive configurations, so exercise caution in deciding what to allow the client to send.

----------

## krisse

Hu, thank you for your suggestion!

Before I delved into the mysteries with strace to guide me, I tried upgrading to the latest (keyworded) gitosis-gentoo version (0.2_p20081028), and that seems to have solved my troubles.

Sorry to have taken up your time for naught.

----------

## Hu

 *krisse wrote:*   

> Sorry to have taken up your time for naught.

 

No need to apologize.  Someone else may find your post and be spared the same search.

----------

