Git how to fix error “failed to connect timeout” while HTTPS from browser works

Are you running into issues when communicating through Git with a remote and the connection timing out, while accessing the Git server via HTTPS from your browser works? Read on.

1. Troubleshooting issue

While doing a Git fetc/pull/push you might see the following error:

$ git pull
fatal: unable to access 'https://github.com/lanedirt/test.repo': Failed to connect to github.com port 443: Timed out

First check if you are able to access your remote Git host (e.g. GitHub) through your browser. If this doesn’t work, then you should check your internet and/or firewall settings. If this does work, move on to the next step.

2. Check proxy settings

If you are able to access the remote Git host through your browser but not through git via HTTPS, the issue might be associated with (corporate) proxy settings. This is especially the case when using Git on Windows hosts.

Check if you are using a corporate proxy in your environment. If so, you should try to configure this proxy URL in the Git global settings as well. Open up a new command prompt or Git Bash window, and type in the following commands:

$ git config --global http.proxy http://[host]:[port]
$ git config --global credential.helper wincred

Note: by setting the credential.helper to “wincred” we let Windows handle any authentication with the proxy for us, so we don’t have to hardcode a username or password into the URL.

Now, try to do a git fetch or push again. Probably, now it works:

$ git pull
Already up to date.

I hope this helped you!

Published
Categorized as Git

By Leendert de Borst

Freelance software architect with 10+ years of experience. Expert in translating complex technical problems into creative & simple solutions.

Leave a comment

Your email address will not be published. Required fields are marked *