服务器设置GIT代理

服务器设置GIT代理

在服务器不能连外网的情况下,配置git代理以同步远端仓库内容

配置Remote SSH config文件设置转发端口

添加如下内容

RemoteForward <remote port> <local proxy>

服务器上配置.gitconfig文件

添加如下内容

[https]
        proxy = http://localhost:<remote port>
[http]
        proxy = http://localhost:<remote port>

验证

首先确认服务器有在监听相应的端口

ss -tln4

然后确认代理生效

HTTPS_PROXY=http://localhost:<remote port> curl https://www.google.com

最后确认git远端仓库地址为https协议

git remote -v
posted @ 2021-09-24 16:44  闽A2436  阅读(185)  评论(0编辑  收藏  举报