github 代理设置 https/git 速度直接从14k/s 飙升 5m+/s

11次阅读

共计 690 个字符,预计需要花费 2 分钟才能阅读完成。

参考链接:https://gist.github.com/fearb…

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

给 git 设置 SOCKS5 代理:
使用 https 的时候,就是使用 https 协议复制仓库的时候
如: https://github.com/KyleBing/T…

git config –global http.proxy ‘socks5://127.0.0.1:1080’
git config –global https.proxy ‘socks5://127.0.0.1:1080’
也可以直接修改用户主目录下的 .gitconfig 文件
[http]
proxy = socks5://127.0.0.1:1080
[https]
proxy = socks5://127.0.0.1:1080

在使用 git 开头的路径时,也就是在使用 ssh 通道时
如:git@github.com:KyleBing/TouchbarBBT.git
打开用户主目录下的 .ssh/config 文件,添加以下内容
ProxyCommand nc -x localhost:1080 %h %p
效果,速度是真快
之前的速度:

之后的速度:

言外
terminal 中设置临时代理
直接执行
export ALL_PROXY=socks5://127.0.0.1:1080
或者在用户主目录下的 .bash_profile 添加别名,这样以后在使用的时候就可以直接输入 proxy 了
alias proxy=”export ALL_PROXY=socks5://127.0.0.1:1080″

正文完
 0