Git through a Proxy. What is causing the 407 error when cloning?

后端 未结 11 2139
长发绾君心
长发绾君心 2020-12-08 16:20

I\'m trying to use Git through a proxy. I\'ve tried setting parameters \'git config --global\' in a lot of ways but always without success when cloning repositories.

相关标签:
11条回答
  • 2020-12-08 17:12

    I had a similar problem trying to git push from a Git Bash client in Windows.

    I fixed it just by browsing to the site using Chrome.
    Then I came back to Git Bash and it worked right away

    For clarity, my GIT repository URL looks like http://me@me.git.cloudforge.com/myproject.git
    And I browsed to http://www.cloudforge.com

    My understanding is that it forces the proxy to resolve this domain.

    0 讨论(0)
  • 2020-12-08 17:12

    Your proxy could also be set as an environment variable. Check if your environment has any of the env variables http_proxy or https_proxy set up and unset them.

    Using command prompt

    # Linux
    export http://user:pass@ip_or_host:port
    export http://user:pass@ip_or_host:port
    
    # Windows
    set HTTP_PROXY = http://user:pass@ip_or_host:port 
    set HTTPS_PROXY = http://user:pass@ip_or_host:port
    

    change Manually

    • Right click on my computer
    • select properties
    • advanced system settings advanced->system variables ->add
    0 讨论(0)
  • 2020-12-08 17:14

    I think that you should start from the HTTP error: HTTP 407 error explained. And from that you can arrive at the answer: proxy error issue. Hope that helps.

    0 讨论(0)
  • 2020-12-08 17:15

    I copied the http proxy section of my .gitconfig to https:

    [http]
            proxy = http://user:pass@ip_or_host:port
    [https]
            proxy = http://user:pass@ip_or_host:port
    

    I put an incorrect password in the http proxy just to check, and it was ignored, so it's the https section that was missing for me.

    Strangely, on another day that didn't work. I don't know if I'm going crazy or if there's another step I forgot. In today's case, this method of setting the proxy worked (with a cleared .gitconfig) from the command line:

    HTTPS_PROXY="http://user:pass@ip_or_host:port/" git clone --progress -v "https://github.com/repo" local_folder
    

    Notes:

    1. If you're on a domain you might need to use the syntax DOMAIN\user.
    2. This didn't work for TortoiseGit, but worked in gitbash on Windows.
    0 讨论(0)
  • 2020-12-08 17:19

    If you are inside a corporate firewall and you are using windows git bash then:

    Open global gitconfig file, usually this will be under C:\Users\USER_NAME.gitconfig and add the below lines if not exists.

    [http]
    proxy = http://USER_NAME:PASSWORD@PROXY_URL:PROXY_PORT
    sslverify = false
    [https]
    proxy = http://USER_NAME:PASSWORD@PROXY_URL:PROXY_PORT
    sslverify = false
    

    Make sure your password does not have '@' character. If you still have the problem and you are using proxy url instead IP then: Open command - 'Windows Key+R' and type cmd then hit enter execute the command:

    nslookup PROXY_URL

    This will give some ip addresses. Try these ip addresses in .giconfig instead of PROXY_URL.

    0 讨论(0)
提交回复
热议问题