Github 代理 https ssh 速度起飞

很多时候我们在使用 github 的时候会出现下载很慢的情况。
如果你有代理,可以直接设置代理,来获取更快下载和上传资源的速度。

HTTP & HTTPS 代理

端口号根据自己的代理端口进行修改,一般 ss 是 1080,Clash 是 7891

1
2
git config --global http.proxy 'socks5://127.0.0.1:7891'
git config --global https.proxy 'socks5://127.0.0.1:7891'

也可以直接修改用户主目录下的 .gitconfig 文件

vim ~/.gitconfig

1
2
3
4
[http]
proxy = socks5://127.0.0.1:7891
[https]
proxy = socks5://127.0.0.1:7891

SSH 代理

打开用户主目录下的 .ssh/config 文件,添加以下内容

vim ~/.ssh/config

1
2
3
4
5
6
7
8
Host github.com
HostName ssh.github.com
User git
Port 443
# socks5 代理(如 Clash) -x
# -v 输出详情 可省略
ProxyCommand nc -v -x 127.0.0.1:7891 %h %p

image-20220509125712706