美文网首页
git 设置 github.com 代理

git 设置 github.com 代理

作者: xczq | 来源:发表于2021-10-12 17:03 被阅读0次

使用 github 的 git 服务时,有时会无法连接服务器。

方式一:修改 ~用户根目录/.gitconfig 文件

添加以下内容:

[http "https://github.com"]
    proxy = http://127.0.0.1:54644
[https "https://github.com"]
    proxy = http://127.0.0.1:54644

还原:直接删除上面内容

方式二:使用命令行

通过命令修改全局.gitconfig文件

git config --global http.https://github.com.proxy http://127.0.0.1:54644 
git config --global https.https://github.com.proxy http://127.0.0.1:54644 

还原:

git config --global --unset http.https://github.com.proxy
git config --global --unset https.https://github.com.proxy

另外

如果要代理所有远程git服务器,可配置系统环境变量

  • http_proxy
  • https_proxy
  • all_proxy

参考

相关文章

网友评论

      本文标题:git 设置 github.com 代理

      本文链接:https://www.haomeiwen.com/subject/qftjoltx.html