Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to get round a silly firewall issue. I am trying to chain ssh access to git through a proxy ssh:

~/git-chain:

#!/bin/bash
ssh hosticangetto ssh $*
# End

And then:

$ export GIT_SSH=~/git-chain
$ git clone ssh://git@somerepostore.com/somerepo.git

E, [2012-02-07T12:50:21.434913 #28359] ERROR -- : git command not recognized
fatal: The remote end hung up unexpectedly

the arguments being passed into my script are:

git@somerepostore.com git-upload-pack 'somerepo.git'

I've checked the keys from the hosticangetto to the git repository store and everything is ok.

I am not sure why this fails. I've done this sort of thing with mercurial before with mercurial -e switch.

share|improve this question
add comment

2 Answers

Add these lines to your ~/.ssh/config (or create that file with these lines if it doesn't already exist):

Host somerepostore.com
    ProxyCommand ssh -W %h:%p hosticangetto

Then unset GIT_SSH.

This tells ssh to ssh using hosticangetto as a proxy. This is better than your solution because in your solution, the packets are decrypted on hosticangetto and then re-encrypted for somerepostore.com on the remote host. Using a proxycommand like this means that packets are encrypted for somerepostore.com on your local machine and these encrypted packets are passed through hosticangetto.

share|improve this answer
    
using ssh proxies does work... but GIT_SSH should work too. Anyway, you're right. Proxy does work. –  nic ferrier Feb 7 '12 at 16:02
add comment

I think you need to do something with the TTY.

This didn't work:

ssh server1 ssh server2

It just hangs there.

This seems to have worked:

ssh -t server1 ssh server2

Looking at the verbose output with ssh -v server1 ssh server2 it looks like the first/outside ssh completes and I get to server1, but I do not execute the inside/second ssh for server2.

share|improve this answer
    
No, I don't think so. chained ssh works fine. I'm not sure what issue you're seeing. I've tried adding tty switches and it makes no difference. It would be pretty wierd if git required a tty to operate. –  nic ferrier Feb 7 '12 at 15:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.