Git配置

git配置http和git协议自动转换

git config --global url."http://gitlab.xxx.io/".insteadOf git@gitlab.xxx.io:

配置完后,查看更改效果:cat ~/.gitconfig:
类似这种:

[url "https://gitlab.xxx.io/"]
        insteadOf = git@gitlab.xxx.io

github 加速

参考:
https://moeyy.cn/gh-proxy/
https://ghproxy.com/

执行命令

git config --global url."https://github.com/".insteadOf https://github.moeyy.xyz/https://github.com/

github设置代理

参考:https://zhuanlan.zhihu.com/p/481574024
设置全局代理

#使用http代理 
git config --global http.proxy http://127.0.0.1:58591
git config --global https.proxy https://127.0.0.1:58591
#使用socks5代理
git config --global http.proxy socks5://127.0.0.1:51837
git config --global https.proxy socks5://127.0.0.1:51837

只对github设置代理

#使用socks5代理(推荐)
git config --global http.https://github.com.proxy socks5://127.0.0.1:51837
#使用http代理(不推荐)
git config --global http.https://github.com.proxy http://127.0.0.1:58591

取消代理

git config --global --unset http.proxy git config --global --unset https.proxy
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐