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

后端 未结 11 2137
长发绾君心
长发绾君心 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: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.

提交回复
热议问题