Last week I worked behind a corporate proxy. This really was a headache because everyone knows that you have an implicit restriction when you try to surf the web. But … I didn´t know the problems I could have with GitHub, trying to sync my repos.
On my everyday tasks I use a lot PowerShell. When I need to acomplish a task, first I try to solve with the command line (if it´s possible, obviously).
So then, when I tried to clone locally a repo, using the
git clone command:
After the execution (I had to wait a few minutes), I got the following error:
Filed to connecto to github.com port 443: Time out
If you ever used Git in your life, you know there is a local configuration for parametrize the user experience. Git provides a tool called git config that lets you get and set configuration variables that control all aspects of how Git looks and operates. Among all the values, you can config the username, password, text editor and more.
For list your configuration settings, you can use the
git config --list command.
If you check the result of that, you cand find the next setting:
That’s my boy! ;)
Well, we’ll find how we can set the values to intent to use the proxy reading the help file. How we can access it? Executing the following:
Override the HTTP proxy, normally configured using the http_proxy, https_proxy, and all_proxy environment variables (see curl(1)). In addition to the syntax understood by curl, it is possible to specify a proxy string with a user name but no password, in which case git will attempt to acquire one in the same way it does for other credentials. See gitcredentials(7) for more information. The syntax thus is [protocol://][user[:password]@]proxyhost[:port]. This can be overridden on a per-remote basis; see remote.<name>.proxy
For solve the “Failed to connect to github.com port 443: Timed out” message we need to run:
Done! You can check if the setting was applied running
git config --global http.proxy