Using GitHub Windows Client Behind A Proxy


Every article on Google tells you literally the same thing, which is to use one of the tags below in your GitHub.config file

proxy = http://servername:port

proxy =

proxy =

proxy = http://domain/username:password@servername:port

Our authenticating proxy is a Microsoft TMG server and none of those worked.  The solution provided by GitHub support along with the explanation why.

Proxy = is probably the one you want. The @ character is a special character when using urls with the credentials in them since it’s the divider between the credential part and the host name. We need to escape that. Try this instead.

Proxy =

similarly if you have any URI-reserved characters in your password you need to URI-encode them as well. You can use (but never put your entire password in. I’ve looked at the source of that site and it looks like it’s only evaluating client side but you can never be too careful).

In case that doesn’t work for you, this is another suggestion that was provided as a possible solution.  Note:  I never tried this.

Proxy = http://domain\username:Password@servername:Port

“Here we hit upon another issue which is that the \ character is a special character _in the git config file format_. It’s used as an escape character, for example \n is used to produce a newline character. This is what’s triggering the error we saw about “Invalid escape at”. Try changing the \ to a double (ie \\). That means “this is really a \, not an escape character.””

And if you are super curious and want some technical background here you go.

“GitHub for Windows essentially consists of two pieces. The GUI which communicates with our API for things like sign in, loading user repositories, creating SSH keys and so on and so forth. The GUI uses Microsoft provided APIs to communicate over HTTP and as such any system-level proxy configurations gets picked up by it.

The second piece is msysgit which is the Windows port of Git. When you do a sync in GitHub for Windows we call into the command line version of Git and do a git pull –rebase && git push (essentially, it’s a bit more to it than that).

Now, msysgit uses something called libcurl to do its http requests. Unfortunately libcurl doesn’t concern itself with system level proxy settings at all and as such you have to configure it.

We are actively developing libgit2 and libgit2sharp which will in time give us a fully native way of doing all git operations (we currently do most if not all _local_ operations through libgit2).”