git:你连端口都没开,你就叫我拉?

130 阅读1分钟

场景:gitlab在服务器的8888端口,8888端口不开放
问题:怎么拉,上哪拉
工具:利用ssh隧道

方法: 本地:8888 —> 服务器:22 -> 服务器:8888
将本地计算机:8888转发到远程服务器:8888
命令:ssh -L 8888:localhost:8888 服务器账号@服务器ip -N

然后就好像在本地拉一样,拉远端
git 拉 http://localhost:8888/root/项目.git

idea操作

image.png