Skip to content

Improve ease of configuring Git to work with corporate proxy #2789

Closed

Description

@DanielKeogh

Problem statement

Clarified here: #2789 (comment)

Description

I used "Open In Desktop" on a repository via Firefox, but Desktop was unable to clone it.

The error message:
Cloning into 'C:\Users\zzzz\Documents\GitHub\VsVim'...
fatal: unable to access 'https://github.com/zzzz/zzzz/': Failed to connect to github.com port 443: Connection refused
Error(s) during clone:
git clone failed: exit status 128

Version

GitHub Desktop version: 1.0.0

OS version: Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. All rights reserved.

Steps to Reproduce

  1. Have a .pac based proxy.
  2. Have no way to get to the internet other than the proxy.
  3. Try and clone
  4. Eventually it times out.

Expected behavior: Expected to clone repo to local machine

Actual behavior: Nothing

Reproduces how often: 100%

Activity

  1. shiftkey commented on Sep 20, 2017

    @shiftkey
    Member

    @DanielKeogh currently you still need to tell Git about your proxy settings:

    git config --global http.proxy http://proxyuser:[email protected]:8080

    Where proxyuser and proxypwd are your credentials, and proxy.server.com:8080 is the server name and port you connect to.

  2. DanielKeogh commented on Sep 20, 2017

    @DanielKeogh
    Author

    If you just tell Git for me, I would really appreciate it. 👍

    (Thanks, this is a feature request now.)

  3. iAmWillShepherd commented on Sep 20, 2017

    @iAmWillShepherd
    Contributor

    Thanks for the suggestion!

    This idea is interesting for the future, but this is beyond the scope of our current roadmap.

    I added the future-proposal label to this issue and closed it so that we won't get overwhelmed with our backlog! We will revisit this in our next planning session.

  4. radumas commented on Oct 13, 2017

    @radumas

    I just want to point out how confusing this issue is for someone who downloads this application, has no configuration required, can login to Github successfully in the app and then.... can't use it.

    Surely the number of people who use Windows in a corporate environment and are behind a proxy is high (everyone I know in government).

  5. MuhammadFaizanKhan commented on Nov 9, 2017

    @MuhammadFaizanKhan

    Any progress? I am getting this error as my system behind proxy.

  6. ehale209 commented on Nov 14, 2017

    @ehale209

    Is there a non-command line option to fix this when using GitHub Desktop? I'm in the same situation. On my work laptop, and don't have a command-line option to enter something like:

    git config --global http.proxy http://proxyuser:[email protected]:8080git config --global http.proxy http://proxyuser:[email protected]:8080

  7. joshaber commented on Nov 14, 2017

    @joshaber
    Contributor

    Unfortunately configuring the proxy from the command line is the only solution I'm aware of.

  8. mapx- commented on Nov 24, 2017

    @mapx-

    So, a windows user can access no command line, right ? or could I edit (or add) some config file in my github desktop ?

  9. joshaber commented on Nov 27, 2017

    @joshaber
    Contributor
  10. rcrodrix commented on Dec 20, 2017

    @rcrodrix

    Thanks, joshaber! Installed it, and ran the command from shiftkey. All is well now. Much appreciated.

  11. harshzalavadiya commented on Mar 9, 2018

    @harshzalavadiya

    i have faced same problem after trying out one complete day got an easy solution(workaround)

    double proxied it with nginx so my behind proxy git repository server is mapped to my local and gocd can do cloning easily

    upstream corp_proxy  {
        server corp_proxy:port; # your corporate proxy
    }
    
    location ~ ^/(git) {
        proxy_buffering off;
        proxy_pass_header on;
        proxy_set_header Host "yoursite.com"; # don't add http etc
        proxy_pass http://corp_proxy;
    }
    
  12. radumas commented on Jun 15, 2018

    @radumas

    So.... now that Microsoft owns GitHub....

  13. zuigz commented on Aug 3, 2018

    @zuigz
  14. 30 remaining items

  15. tierninho commented on Mar 17, 2020

    @tierninho
    Contributor

    For those you who are interested in helping us verify the new functionality supporting proxies, we kindly ask for any feedback as it is much appreciated, Thank you!

    You will need to run a command to disable the workaround: git config unset --global http.proxy then download Beta: https://github.com/desktop/desktop#beta-channel, sign in, and you are good to go!

    cc @datalifenyc @radumas @rizwanjaved @renu555 @schlamar @MuhammadFaizanKhan @amayii0 @DanielKeogh @NanoJoey @priyanshnama @AtomicCons

  16. billygriffin commented on Mar 17, 2020

    @billygriffin
    Contributor

    Hi all! @datalifenyc @radumas @rizwanjaved @renu555 @schlamar @MuhammadFaizanKhan @amayii0 @DanielKeogh @NanoJoey @priyanshnama @AtomicCons

    I know you've already done the manual setup involved in getting this working, so apologies for the ask.

    Would you be willing to help us verify that what we're planning to release does actually work as intended by unsetting the proxy config and downloading the current beta version? We've done some manual testing, but verifying that it works from someone who actually experienced the problem first hand would be really helpful in giving us confidence that we're helping others who had the same problem y'all did.

    Here are the steps:

    1. Run git config --global --unset http.proxy in the terminal
    2. Download and install the beta version of Desktop
    3. Run the beta version and clone any repo from GitHub
    4. Ensure that fetching, pushing, or pulling works as expected

    If it worked properly, using the beta version should just set the proper Git config proxy settings up for you and hopefully is transparent. Please let us know if you're able to test this, and we're happy to answer any questions about the steps if you have them. Thank you!

  17. DanielKeogh commented on Mar 18, 2020

    @DanielKeogh
    Author

    I would, but I'm not behind this kind of proxy any more.

  18. radumas commented on Mar 23, 2020

    @radumas

    #2789 (comment)

    1. Run `git config unset --global http.proxy` in the terminal
    

    So I'm actually now running into the reverse issue, not necessarily using our proxy while WFH. I got an error message on this line that

    git config unset --global http.proxy
    error: key does not contain a section: unset

    Also your link in Point 2 is wrong. I will test the new Beta when I am connected to our proxy though!

  19. billygriffin commented on Mar 24, 2020

    @billygriffin
    Contributor

    @radumas Apologies! I updated my comment. I believe the command should instead be git config --global --unset http.proxy and I updated the beta link to be the correct one. Sorry about that!

  20. mohammadyacn314 commented on Mar 29, 2020

    @mohammadyacn314

    just disable antivirus & firewall or
    convert https to http

  21. billygriffin commented on Mar 30, 2020

    @billygriffin
    Contributor

    This shipped in 2.4, so hopefully the vast majority of people using Desktop from behind a proxy it'll just work! Thanks for the input y'all. ❤️

  22. jshealth commented on May 4, 2020

    @jshealth

    Doesn't work for me. I installed 2.4.3 over a previous version (from Nov 2019).
    I'm connected to my internal network via VPN and then authenticated Proxy out to GitHub.
    I'm on Windows 10
    Git itself is working fine for remote operations with config credential.helper=wincred (I don't have any http.proxy settings in git itself, or in my shell (Powershell)). Proxy is set in Windows System Settings with a pac script.
    So if I try to pull from a remote on Github with Github Desktop I get
    "fatal: unable to access 'https://github.com....': Received HTTP code 407 from proxy after CONNECT"
    but if I choose from Github Desktop "Repository > Open in Powershell" and then do git pull, it works fine, with no need to type username / password, since they are stored in Windows Credential Manager and git is configured to use wincred for credential.helper
    I want Github Desktop to work though because there are other users in our org who would benefit from using the GUI for remote operations.

  23. TheNetworkIsDown commented on Jul 2, 2020

    @TheNetworkIsDown

    Neither using .gitconfig nor the corresponding Git command make it use the proxy.

    [http]
    	proxy = http://user:[email protected]:80
    [https]
    	proxy = http://user:[email protected]:80
    

    (Yes the last line is correct, we are using HTTP CONNECT to tunnel HTTPS across the HTTP connection)

    The connection to the proxy is made but a 407 is returned because no credentials are sent. (There is no Proxy-Authorization: header at all in the request to the proxy.)

  24. TomF475 commented on Feb 2, 2022

    @TomF475

    I don't believe this issue is fixed as it's not working for me either.

    I've just installed v2.9.6 and although I've been able to sign in to GitHub Desktop I can't even clone any repos. I continue to get the "Received HTTP code 407 from proxy after CONNECT" error.

    Updating gitconfig with proxy details, either with or without credentials, makes absolutely no difference, the same error is returned.

  25. steveward commented on Feb 8, 2022

    @steveward
    Contributor

    @TomF475 the 407 error usually indicated that your credentials are not being accepted. Can you verify you configured the proxy settings correctly in your .gitconfig?

  26. TheNetworkIsDown commented on Feb 9, 2022

    @TheNetworkIsDown

    Why are we even discussing this here. The issue is closed. Why is it closed?!

  27. jshealth commented on Feb 9, 2022

    @jshealth

    Agree, with @NotAProfessionalDeveloper @TomF475 I posted after the issue was closed because it was not resolved for me.
    I just ended up not using GitHub Desktop.

  28. amayii0 commented on Feb 9, 2022

    @amayii0

    Agree, with @NotAProfessionalDeveloper @TomF475 I posted after the issue was closed because it was not resolved for me. I just ended up not using GitHub Desktop.

    Same as @jshealth, Visual Studio Code is enough for me.
    Atlassian Sourcetree when going fancy.
    image

  29. zeocax commented on Jul 5, 2025

    @zeocax

    FYI, if you still face some problem on the proxy with git (like me), this issue may be caused by git's default anyauth proxy setting. It fails if the proxy doesn't respond to the initial request with a standard 407 challenge. While this challenge-response behavior from git is compliant with RFC 7235, some proxies may not follow this specific flow.

    The fix is to force git to use Basic auth proactively with this command:

    git config --global http.proxyAuthMethod 'basic'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementproxy

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions