【问题标题】:How to set squid for http proxy and make git use it?如何为 http 代理设置 squid 并让 git 使用它?
【发布时间】:2017-06-07 15:10:58
【问题描述】:

简介
我有一个 http 代理,其中有一个不寻常的密码,其中包含“@”。我无法改变它。我必须只使用代理连接,即每个软件都必须使用代理,否则它们不起作用。

情况
我使用 Ubuntu 16.04。
我已经使用用户名和密码设置了gnome settings 代理。我设置了/etc/environment 文件来指定http 代理。我已经单独设置apt 使用代理设置。

以上所有配置都有一个共同点,'@' 不被直接接受,我不得不使用 %40 对其进行转义。要通过终端传递代理用户名、密码、地址和端口,我必须使用http://username:password@server:port。问题就出现在这里,因为大多数软件在我用@写密码时都会感到困惑。类似pass@word

git 的问题
Link to how to make git work with http proxy
我设置~/.gitconf文件如下:

  • 案例一:

[http]
代理=http://user:pass@word@server:port

  • 案例 2:

[http]
代理=http://user:pass%40word@server:port

  • 案例 3:

[http]
代理=http://user:pass%%40word@server:port

所有这些都不起作用。


我在朋友的 macOS Sierra 中使用 squidman 设置父代理,并设置 git 的代理以使用 squidman 正在侦听的端口和 git 工作。

为了复制相同的行为,我在 Ubuntu 16.04 中安装了 squid。
我已将squid.conf 文件设置如下:

http_port 3128
cache_peer server parent port 0 no-query no-digest login=user:pass%%40word      
#as specified by squid config rules in comments

并将 git 代理设置为

[http]
    proxy = localhost:3128

这仍然让我无法连接到服务器

问题
如何正确设置 Squid 代理?

My details for proxy are like (they are invariants):
    Username: user
    Password: pass@54321
    Server: 192.25.5.6 //The server is in my network
    Port: 808

如何让 git 使用 squid 的代理?


参考不是必需的,但会非常有帮助。

【问题讨论】:

    标签: git proxy http-proxy squid


    【解决方案1】:

    git 配置文件被称为“.gitconfig”,而不是您在问题中提到的“.gitconf”。这可能就是您的设置没有按预期工作的原因

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-12-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-22
      • 1970-01-01
      相关资源
      最近更新 更多