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?
SSH is a secure shell and it offers a private connection between hosts. SSH port forwarding is one method that is used to tunnel traffic through an SSH connection. This can be done either locally or remotely if you are not close by to the target machine. Port 22 is used by default for establishing SSH connections.
Also known as dynamic tunneling, or SSH SOCKS5 proxy, dynamic port forwarding allows you to specify a connect port that will forward every incoming traffic to the remote server dynamically.
If you are able to SSH into [email protected] over port 443, you can override your SSH settings to force any connection to GitHub.com to run through that server and port.
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With