1. Plan 1
The following command is only for github.com
, and may also be used in Chinagitee.com
, so all git sites cannot be added with agents.
# 设置代理
git config --global http.https://github.com.proxy socks5://127.0.0.1:1086
# 取消代理
git config --global --unset http.https://github.com.proxy
Use cdn to accelerate
git config --global url."https://ghproxy.com/https://github.com".insteadOf "https://github.com"
or
git config --global url."https://hub.fastgit.xyz/".insteadOf "https://github.com/"
2. Method 2
2.1 Open the hosts file
sudo vim /etc/hosts
2.2 Add the github.com domain name (just add it under localhost)
140.82.114.4 github.com
If it doesn’t work or the internet speed is too slow, you can try changing the domain name, which can be found online.
3. Method 3
#取消http代理
git config --global --unset http.proxy
#取消https代理
git config --global --unset https.proxy