GitHub Windows client behind proxy

2019-01-10 02:01发布

I'm trying to get the GitHub client for Windows working. I am on a corporate Win 7 x64 computer behind a corporate proxy and firewall. Following various other posts and experimenting with multiple combinations of environment variables and config variables I have found the only way to get cloning and push updates to work is by using the HTTPS_PROXY environment variable, including my full corporate domain user ID and password.

This is unacceptable from a security standpoint. Is there any other way to get this to work?

Additional notes:

The following worked:

  • Add an environment variable called HTTPS_PROXY with the value http://[domain]\[userid]:[password]@someproxy.mycorp.com:8080

The following did not work:

  • Omitting user id and password from HTTPS_PROXY variable
  • Using an environment variable called HTTP_PROXY (no S)
  • Adding the http.proxy variable to the global config file (.gitconfig)
  • Adding the https.proxy varaible to the global config file

In all cases, the GitHub client still does not recognize the proxy: The content of the file TheLog.txt always shows the following on startup:

[time]|INFO|thread:4|GitHub.Helpers.StartupLogger|Proxy information: (None)
[time]|INFO|thread:4|GitHub.Helpers.StartupLogger|Couldn't fetch creds for proxy

And is followed by the output of several failed proxy authentication attempts, all of which indicate "Credentials are missing."

9条回答
虎瘦雄心在
2楼-- · 2019-01-10 02:03

For us, the solution involved two different things. First, as described in Sogger's answer, you need to add the entries to your .gitconfig file, located in %USERPROFILE%.

[http]
    proxy = http://<proxy address>:<proxy port>

[https]
    proxy = https://<proxy address>:<proxy port>

Second, (and this was the missing piece for us,) you need to configure an exception on the proxy server to allow non-authenticated proxy traffic to *.github.com

In iPrism, it looks like this: enter image description here

The problem is not so much the proxy, but the authentication. Bypassing the authentication requirement allows the needed communication to clone and work with projects using the GitHub desktop client.

Also note that this approach did not require storing proxy credentials in the .gitconfig file.

查看更多
时光不老,我们不散
3楼-- · 2019-01-10 02:05

Add these entries to your '.gitconfig' file in your user directory (go to %USERPROFILE%):

[http]
    proxy = http://<proxy address>:<proxy port>

[https]
    proxy = https://<proxy address>:<proxy port>

And if you don't want to store your password in plaintext, I would use a local proxy forwarder like CNTLM which allows you to direct all traffic through it and can store the passwords hashed.


Unlike the original question, if you don't care if your password is in plain text add these:

[http]
    proxy = http://<username>:<password>@<proxy address>:<proxy port>

[https]
    proxy = https://<username>:<password>@<proxy address>:<proxy port>
查看更多
三岁会撩人
4楼-- · 2019-01-10 02:07

If you’re using GitHub for Windows in a corporate, chances are high that you’re behind a big bad Corporate Firewall/Proxy. GitHub for Windows doesn’t yet have the proxy parameters in its GUI for setting Options.

To configure GitHub for Windows to use your corporate proxy, edit the .gitconfig file typically found at C:\Users\.gitconfig or C:\Documents & Settings\.gitconfig

Close GitHub for Windows; In .gitconfig, just add

[https] proxy = proxy.yourcompany.com:port

查看更多
老娘就宠你
5楼-- · 2019-01-10 02:07

i dont know about your firewall, but my campus use proxy

do you use any git gui? EDIT : just noticed that you're using github client for windows

i am using tortoisegit and its very easy to set the proxy. Just right click anywhere, tortoisegit>network, enable proxy server and set server address, username, and password. done

as far as i remember, tortoisegit will also works out-of-the-box with github.

查看更多
孤傲高冷的网名
6楼-- · 2019-01-10 02:07

I found this blog to be useful. It describes ntlmaps proxy. It's probably less secure, but worked smoothly. I couldn't get cntlm working.

查看更多
SAY GOODBYE
7楼-- · 2019-01-10 02:20

Tried everything of above - and didn't succeed, only thing that helped me is CNTLM - http://cntlm.sourceforge.net/.

Install it and run cntlm -H, than authenticate to corp proxy, edit cntlm.ini file with the output of cntlm, restart the windows service. Update .gitconfig with:

[https] proxy = localhost:3128
[http] proxy = localhost:3128

Now cntlm will do all the authentication, and you'll be able to use GitHub(and Dropbox, btw) behind the corp proxy. At least until next password change :) (than do cntlm -H stuff again)

查看更多
登录 后发表回答