修改 Git 方法
https://www.cnblogs.com/dakewei/archive/2017/08/31/7461069.html
https://www.jianshu.com/p/aac268316639
https://www.zhihu.com/question/27159393/answer/141047266
此方法亲测最有效!
- 安装 Git
brew install git
- 设置 socks5 代理
方式一: 设置全局使用socks5代理,并且使用 http
传输(提速真的很明显),
只能使用https://github.com/xxx/xxx.git
# 代理设置
# 端口号可以自己查看 ssr 的设置
git config --global http.proxy 'socks5://127.0.0.1:1086'
git config --global https.proxy 'socks5://127.0.0.1:1086'
# 推荐,只代理 github,不影响国内 repo
git config --global http.https://github.com.proxy https://127.0.0.1:1086
git config --global https.https://github.com.proxy https://127.0.0.1:1086
# 取消代理设置
git config --global --unset http.proxy
git config --global --unset http.https
方式二:
在 ~/.gitconfig
文件中添加下面的文本
[http]
proxy = socks5://127.0.0.1:1080
[https]
proxy = socks5://127.0.0.1:1080
-
开始 clone
如果觉得仓库太大,可以在 git clone 中加入参数--depth=1
,只拉取最近的一个 revision。 -
如果后面想看历史的版本,使用 git fetch 即可。
git fetch --unshallow
中转 Git 方法
通过 gitee.com or coding.net or gitlab.com 进行中转下载.
修改 DNS 方法
通过 ipaddress.com 去查真实 ip 然后更改 hosts 的方法,发现这是个坑。
https://blog.csdn.net/u012413167/article/details/81299416
将 DNS 改为 8.8.8.8
查询未被污染的ip也可以 nslookup -vc github.com 8.8.8.8
修改 hosts 方法
此方法用处不大.
在 /etc/hosts
文件中手动或者用 vim 添加
151.101.76.249 github.global.ssl.fastly.net
192.30.253.112 github.com
# 刷新缓存
sudo dscacheutil -flushcache