1.设置代理
http方式:
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy http://127.0.0.1:1080
ssh方式:
git config --global http.proxy socks5://127.0.0.1:1080
git config --global https.proxy socks5://127.0.0.1:1080
2.查看代理信息
git config --global http.proxy
git config --global https.proxy
3.删除代理
git config --global --unset http.proxy
git config --global --unset https.proxy
4.校验ssh方式
ssh -T git@gitlab.com
ssh:connect to host gitlab.com port 22:Operation time out
解决方案:
添加~/.ssh/config文件
内容:
Host gitlab.com
Hostname ssh.gitlab.com
User git账号
Port 443
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa