tags:

views:

2919

answers:

4

My situation is, I can ssh to ComputerB (Code repos) where git repos is put. But my local connection is too slow to clone the code. And I can ssh to another machine (ComputerA) which is faster, so I want to clone the code through ComputerA.

This is what I did:

           ssh tunnel                           ssh tunnel
MyComputer ----------> ComputerA (I can ssh to) ----------> ComputerB (where the Code repos is and I can ssh to but too slow)

Using a command like this:

ssh -L1234:ComputerA_ip:22 Code_repos_ip

Then:

git clone git+ssh//localhost/repos local_repos (how can I assign the port 1234?)

If this doesn't work, what else can I do?

A: 

First clone to ComputerA, then clone from ComputerA to ComputerB. You'll have to ssh to ComputerA in order to pull in new stuff, though.

JesperE
+2  A: 

How will going through two connections make your connection faster?

Anyhow, you should be able to do:

git clone git+ssh://localhost:1234/repos local_repos
Brian Campbell
A: 

Check out the command files for SSH. You can have a command automatically execute when you log in via SSH. This is specified in the authorized_keys file. So, on Computer A, you will have a command file that automatically SSH-es into Computer B. Then when you connect to Computer A, it will do it automatically to Computer B. To your computer, it is directly connected to Computer B. You can even use a compressed tunnel.

sybreon
A: 

Also, you can try to put port number in your ~/.ssh/config:

Host ComputerA
HostName localhost
Port 1234

And then use ComputerA in git clone command:

git clone git+ssh://ComputerA/repos local_repos
Alexander Artemenko