本机 v2rayN 开的服务,默认 http 端口为 10809,socks端口为10808


接管配置
全部接管
1 2 3 4 5
| git config --global http.proxy socks5://127.0.0.1:端口号 git config --global https.proxy socks5://127.0.0.1:端口号 #比如端口号为10808,执行下面的命令即可 # git config --global http.proxy socks5://127.0.0.1:10808 # git config --global https.proxy socks5://127.0.0.1:10808
|

接管 Github
1 2 3 4
| git config --global http.https://github.com.proxy socks5://127.0.0.1:端口号 git config --global https.https://github.com.proxy socks5://127.0.0.1:端口号 #git config --global http.https://github.com.proxy socks5://127.0.0.1:10808 #git config --global https.https://github.com.proxy socks5://127.0.0.1:10808
|

检查设置
全部接管的检查
1 2
| git config --global --get http.proxy git config --global --get https.proxy
|

接管 Github 的检查
1 2
| git config --global --get http.https://github.com.proxy git config --global --get https.https://github.com.proxy
|

还原设置
取消全部接管
1 2
| git config --global --unset http.proxy git config --global --unset https.proxy
|
取消接管 Github
1 2
| git config --global --unset http.https://github.com.proxy git config --global --unset https.https://github.com.proxy
|
SSH代理
修改 ~/.ssh/config
文件(不存在则新建):
~
就是%userprofile%
,也就是用户目录
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| # 端口号要替换 ProxyCommand connect -S 127.0.0.1:10808 -a none %h %p
Host github.com User git Port 22 Hostname github.com # 注意修改路径为你的路径 IdentityFile "C:\Users\Administrator.SC-201902031211\.ssh\id_rsa" TCPKeepAlive yes
Host ssh.github.com User git Port 443 Hostname ssh.github.com # 注意修改路径为你的路径 IdentityFile "C:\Users\Administrator.SC-201902031211\.ssh\id_rsa" TCPKeepAlive yes
|

测试
最后下载一个文件测试一下
未配置前,下载了好久都下载不下来

配置后

这个文件大小总共3G


参考文章