让 Git 与代理服务器一起工作 - 因“请求超时"而失败; [英] Getting Git to work with a proxy server - fails with "Request timed out"

查看:22
本文介绍了让 Git 与代理服务器一起工作 - 因“请求超时"而失败;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何让 Git 使用代理服务器?

How do I get Git to use a proxy server?

我需要从 Git 服务器检出代码,但每次都显示请求超时".我该如何解决这个问题?

I need to check out code from a Git server, but it shows "Request timed out" every time. How do I get around this?

或者,我如何设置代理服务器?

Alternatively, how can I set a proxy server?

推荐答案

要使用的命令:

git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080

  • proxyuser 更改为您的代理用户
  • proxypwd 更改为您的代理密码
  • proxy.server.com 更改为您的代理服务器的 URL
  • 8080 更改为您的代理服务器上配置的代理端口
    • change proxyuser to your proxy user
    • change proxypwd to your proxy password
    • change proxy.server.com to the URL of your proxy server
    • change 8080 to the proxy port configured on your proxy server
    • 请注意,这适用于 http 和 https 存储库.

      Note that this works for both http and https repos.

      如果您决定随时重置此代理并在没有代理的情况下工作:

      If you decide at any time to reset this proxy and work without proxy:

      要使用的命令:

      git config --global --unset http.proxy
      

      最后,检查当前设置的代理:

      Finally, to check the currently set proxy:

      git config --global --get http.proxy
      

      这篇关于让 Git 与代理服务器一起工作 - 因“请求超时"而失败;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆