我的情况是,我可以ssh到放置git repos的ComputerB(Code repos).但我的本地连接速度太慢,无法克隆代码.我可以ssh到更快的另一台机器(ComputerA),所以我想通过ComputerA克隆代码.
这就是我做的:
ssh tunnel ssh tunnel
MyComputer ----------> ComputerA (I can ssh to) ----------> ComputerB (where the Code repos is and I can ssh to but too slow)
Run Code Online (Sandbox Code Playgroud)
使用这样的命令:
ssh -L1234:ComputerA_ip:22 Code_repos_ip
Run Code Online (Sandbox Code Playgroud)
然后:
git clone git+ssh//localhost/repos local_repos (how can I assign the port 1234?)
Run Code Online (Sandbox Code Playgroud)
如果这不起作用,我还能做什么?
Bri*_*ell 14
如何通过两个连接使您的连接更快?
无论如何,你应该能够做到:
git clone git+ssh://localhost:1234/repos local_repos
Run Code Online (Sandbox Code Playgroud)
此外,您可以尝试将端口号放入~/.ssh/config:
Host ComputerA
HostName localhost
Port 1234
Run Code Online (Sandbox Code Playgroud)
然后在git clone命令中使用ComputerA:
git clone git+ssh://ComputerA/repos local_repos
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
20231 次 |
| 最近记录: |