即使用username:password设置代理后,git clone也会失败

时间:2013-09-17 13:56:42

标签: git

我正在尝试从https://github.com/RestKit/RestKit.git克隆RestKit 这是我到目前为止所做的:

  1. 已安装的git。

  2. .gitconfig

    中设置包含正确参数的~/文件
    [user]  
        name = myName   
        email = myEmail  
    [http]  
        proxy = http://<username for proxy>:<password for proxy>@PROXY:8080  
        sslverify = false  
    [https]  
        proxy = https://<username for proxy>:<password for proxy>@PROXY:8080  
    
  3. 按如下方式启动克隆命令:

    git clone https://github.com/RestKit/RestKit.git  
    
  4. 我收到以下错误:

    Cloning into 'RestKit'...  
    error: Could not resolve host: (nil); nodename nor servname provided, or not known while accessing https://github.com/RestKit/RestKit.git/info/refs?service=git-upload-pack  
    fatal: HTTP request failed  
    

    我错过了什么?

    更新:
    当我用。替换.gitconfig文件中的http.proxy时     http://:8080

    即没有凭据,我收到以下错误:

    Cloning into 'RestKit'...  
    error: The requested URL returned error: 407 while accessing https://github.com/RestKit/RestKit.git/info/refs?service=git-upload-pack  
    fatal: HTTP request failed  
    

2 个答案:

答案 0 :(得分:0)

有时,如果没有首先指定域,代理就无法工作。尝试将此添加到您的.gitconfig

[http]
    proxy = http://mydomain\\myusername:mypassword@PROXY:8080

还要进一步了解this question它可能会指出一些问题。

答案 1 :(得分:0)

好吧我弄明白了这个问题。我的密码有一个'@',因为密码中的'@'之后的任何内容都被视为代理地址。相当简单和愚蠢,但我花了很长时间才弄清楚这一点。 :(

相关问题