1. Home
  2. Docs
  3. git
  4. 代理配置

代理配置

http代理设置

git config --global http.proxy http://127.0.0.1:1087 # 设置

git config --global --unset http.proxy # 取消设置

命令操作的文件C:\Users\用户名.gitconfig

win-ssh代理配置

  1. 修改文件 C:\Users\wby\.ssh\config (如果文件则创建)
  2. 写入内容 ProxyCommand "C:\Program Files\Git\mingw64\bin\connect.exe" -S 127.0.0.1:1080 %h %p (所有的GIT仓库都会走代理)

Tip: 配置指定域名需要走代理的

Host github.com
  ProxyCommand "C:\Program Files\Git\mingw64\bin\connect.exe" -S 127.0.0.1:1080 %h %p

Host gitlab.com
  ProxyCommand "C:\Program Files\Git\mingw64\bin\connect.exe" -S 127.0.0.1:1080 %h %p

mac-ssh代理

.ssh/config

Host github.com
        ProxyCommand=nc -X 5 -x 127.0.0.1:10886 %h %p

相关资料

Git bash 走代理
Windows 上给 Git SSH 设置代理

Was this article helpful to you? Yes No

How can we help?