【git】GitHub 的专用代理地址
你可以通过如下方式来修改 Git 中对 github.com
的专属代理设置,具体取决于你是想更换地址、取消代理,还是改为通用代理。
✅ 一、修改 GitHub 的专用代理地址
如果你想将 http://192.168.50.65:7890
改成 http://127.0.0.1:7890
,执行:
git config --global http.https://github.com.proxy http://127.0.0.1:7890
git config --global https.https://github.com.proxy http://127.0.0.1:7890
✅ 二、取消 GitHub 的专用代理设置(恢复为无代理)
git config --global --unset http.https://github.com.proxy
git config --global --unset https.https://github.com.proxy
✅ 三、改为通用代理(对所有地址生效)
git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy http://127.0.0.1:7890
可与上一步的取消配合使用,即先取消 GitHub 专属代理,再设通用代理。
🔍 四、验证是否生效
git config --list
你将看到类似:
http.proxy=http://127.0.0.1:7890
https.proxy=http://127.0.0.1:7890
如你使用的是 socks5,可以把 http://
换成 socks5://
。
如果你需要我帮你写一个自动切换脚本(开启/关闭代理),也可以告诉我。