github 配置代理
Windows平台
Windows平台的git中预置了connect.exe,可以用来接管git的流量。可以通过修改本地SSH配置文件来更改git的代理设置。
Windows平台配置文件位于C:\Users\$USERNAME$\.ssh\config,其中USERNAME是你的用户名。
在文件中加入如下配置:
1
|
Host github.com *.github.com # 指定代理规则作用域
|
注意选择SOCKS还是HTTPS代理需要根据代理软件支持的协议而定。如果软件在本机运行,host设置为本机(127.0.0.1)即可,端口号则设置为代理软件的监听端口号。
查看
git config --global --get http.https://github.com.proxy
root@x86:/home/ubuntu# git config --global http.https://github.com.proxy socks5h://127.0.0.1:1080 root@x86:/home/ubuntu# git config --global --get http.https://github.com.proxy socks5h://127.0.0.1:1080 root@x86:/home/ubuntu#
设置
git config --global https.proxy https://127.0.0.1:1080
root@x86:/home/ubuntu# git config --global --get https.proxy https://10.0.0.85:1080 root@x86:/home/ubuntu#
#取消代理 git config --global --unset http.https://github.com.proxy)
root@x86:/home/ubuntu# git config --global --unset http.https://github.com.proxy root@x86:/home/ubuntu# git config --global --unset https.proxy root@x86:/home/ubuntu#