Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
DanielKeogh opened this issue Sep 20, 2017 · 51 comments
Closed

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

DanielKeogh opened this issue Sep 20, 2017 · 51 comments
Labels
enhancement proxy Issues related to the use of proxies

Comments

@DanielKeogh
Copy link

DanielKeogh commented Sep 20, 2017

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%

@shiftkey
Copy link
Member

shiftkey commented Sep 20, 2017

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

git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080

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

@DanielKeogh
Copy link
Author

DanielKeogh commented Sep 20, 2017

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

(Thanks, this is a feature request now.)

@iAmWillShepherd
Copy link
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.

@radumas
Copy link

radumas commented Oct 13, 2017

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).

@MuhammadFaizanKhan
Copy link

MuhammadFaizanKhan commented Nov 9, 2017

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

@ehale209
Copy link

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:proxypwd@proxy.server.com:8080git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080

@joshaber
Copy link
Contributor

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

@mapx-
Copy link

mapx- commented Nov 24, 2017

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

@joshaber
Copy link
Contributor

Se https://git-for-windows.github.io to install Git on the command line for Windows.

@rcrodrix
Copy link

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

@harshzalavadiya
Copy link

harshzalavadiya commented Mar 9, 2018

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;
}

@radumas
Copy link

radumas commented Jun 15, 2018

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

@zuigz
Copy link

zuigz commented Aug 3, 2018

Thanks. At least I can work with 👍
git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080

@pallipavan
Copy link

i have .pac file
can you give the command how to set proxy (.pac file) to git?

@iAmWillShepherd
Copy link
Contributor

i have .pac file
can you give the command how to set proxy (.pac file) to git?

For anyone else curious about ☝️, have a look at issue #5516.

@billygriffin billygriffin changed the title Desktop cannot clone repository through corporate proxy. Improve ease of configuring Git to work with corporate proxy Oct 10, 2018
@amayii0
Copy link

amayii0 commented Oct 24, 2018

I also encountered that difficulty with GitHub Desktop 1.4.3

It was clearly not obvious to:
1/ Install GitHub Desktop without admin rights, deployed to C:\Users\this_is_me\AppData\Local\GitHubDesktop\app-1.4.3\GitHubDesktop.exe
2/ Login, see my repositories, fail to checkout
3/ Find this post
4/ Install Git for Windows WITH admin rights, deployed to C:\Program Files\Git\git-cmd.exe
5/ Find out how to get my proxy settings
5a/ They are not under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings
5b/ Get AutoConfigURL from registry, which points to a wpad.dat
5c/ Analyse the wpad.dat to find out name of proxy server
6/ Finally use Git For Windows to type in the git config --global my_proxy_server:and_its_port

Hopefully community was contributing to this one :-)

@MuhammadFaizanKhan
Copy link

Well, it is proxy problem and i am able to solve this using
git cofig --global http.proxy mySystemIP:@ProxyIP:ProxyPort

@billygriffin
Copy link
Contributor

billygriffin commented Nov 6, 2018

Reopening this issue as in one of our next few releases, we'd like to explore how we can ease the pain of getting onboarded to GitHub Desktop when folks are working in an environment with a proxy.

I want to just clarify the primary problem statement, and find out if there's anything missing:

  • When I download GitHub Desktop behind a proxy, I'm unable to use the app - requests just time out without a logical error message. I want GitHub Desktop to help get me over the hump of proxy configuration without me having to do some manual setup using the command line so that I can use the app normally.

Also want to make sure you have 👀 on this @desktop/support to ensure it properly captures the extent of what we're trying to solve for here.

@radumas
Copy link

radumas commented Nov 6, 2018

Thanks for reopening this @billygriffin. I just want to flesh out the process more fully on a fresh workstation running Windows 10 Pro (64-bit) to show what is confusing to a user. I've installed the app from the .exe and am invited to Sign in to Github.com.

image

Success!

image

Now to download a repository to work on it... I can see repositories on Github.com

image

That's odd... I was just seeing what was on Github.com! Why can't I download a repository

image

@billygriffin
Copy link
Contributor

This is incredibly helpful @radumas, thank you SO much! ❤️

@amayii0
Copy link

amayii0 commented Nov 6, 2018

Same as @DanielKeogh but with pictures, always easier than a thousand words :)

@rizwanjaved
Copy link

well, over here its get resolved by adding github.com in /etc/hosts file and restarting the webserver
would anybody explain to me how it's working?
and one more thing first is saying
Failed to connect to github.com port 443: Network is unreachable
After using sudo the error becomes
Could not resolve host: github.com

@billygriffin billygriffin added this to Backlog (unprioritized) in Desktop 2.4 release via automation Jan 30, 2020
@niik niik added the proxy Issues related to the use of proxies label Feb 11, 2020
@billygriffin billygriffin moved this from Backlog (unprioritized) to Prioritized backlog (ordered) in Desktop 2.4 release Feb 11, 2020
@datalifenyc
Copy link

datalifenyc commented Feb 18, 2020

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).

To be clear, for those that don't want to pass their username and password credentials, you can still use a combination of @shiftkey's git command and @schlamar's git config:

git config --global http.proxy http://:@yourproxyserver:8080/

@billygriffin
Copy link
Contributor

Hi folks, just as an update we're actively working on making this easier and hopefully transparent for people using nonauthenticating proxies (which represent the majority of proxies as we understand it). We're hoping that this should be available in our next major release.

@billygriffin
Copy link
Contributor

Since this is now shipped to beta in #9154 and the other associated issues, I'm going to close this issue.

Desktop 2.4 release automation moved this from In Progress Issues to Done! Mar 17, 2020
@tierninho
Copy link
Contributor

tierninho commented Mar 17, 2020

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

@billygriffin
Copy link
Contributor

billygriffin commented Mar 17, 2020

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!

@DanielKeogh
Copy link
Author

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

@radumas
Copy link

radumas commented Mar 23, 2020

#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!

@billygriffin
Copy link
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!

@mohammadyacn314
Copy link

mohammadyacn314 commented Mar 29, 2020

just disable antivirus & firewall or
convert https to http

@billygriffin
Copy link
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. ❤️

@jshealth
Copy link

jshealth commented May 4, 2020

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.

@TheNetworkIsDown
Copy link

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

[http]
	proxy = http://user:pass@proxy.example.com:80
[https]
	proxy = http://user:pass@proxy.example.com: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.)

@TomF475
Copy link

TomF475 commented Feb 2, 2022

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.

@steveward
Copy link
Member

@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?

@TheNetworkIsDown
Copy link

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

@jshealth
Copy link

jshealth commented Feb 9, 2022

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.

@amayii0
Copy link

amayii0 commented Feb 9, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement proxy Issues related to the use of proxies
Projects
No open projects
Development

No branches or pull requests