Git issue: Failed to connect (Timed Out)
Solution 1
- Try removing the origin and setting the origin again.
Check the remote
$ git remote -v
Remove the remote
$ git remote rm origin
Set the remote again
$ git remote set-url origin <url>
-
Try to change the url of the remote origin in the .git/config file in your working directory.
[remote "origin"]
fetch = +refs/heads/:refs/remotes/origin/
url = ssh://oldhost.com/usr/local/gitroot/myproject.git
I hope this should help you sort the issue.
Solution 2
A minor change to @Vamsi Ravi answer was a change to third step to: git remote add origin <url>
. After adding the remote once removed I was then able to push as expected.
Solution 3
fatal: unable to access 'https://github.com/mdsowmya/Test.git/': Failed to connect to github.com port 443: Timed out
Solutions:
- Please check if you are behind any network proxy configured(Internet Options)
Unset the proxy configuration through git:
git config --global --unset http.proxy http://proxyuser:[email protected]:8080
- If connected to company/office laptop, check your VPN connection/firewall settings.
Disabling VPN will help you connect to github. Worked for me :)
user3342582
Updated on July 21, 2022Comments
-
user3342582 almost 2 years
I'm having the same issue as described here, but unfortunately that did not receive an answer...
Essentially, whenever I try to push/clone to a git repository (whether its from Github or another site), I am unable to do so. I am getting the following error every time:
fatal: unable to access '(repo url)': Failed to connect to (domain) port 443: Timed Out
Most solutions I found involved setting a proxy, but I am currently not running a proxy. Another idea was that my Firewall may be blocking it.
I was able to push/clone git repositories in the past (about 3 months ago), but since trying again a few days ago it has not worked. My colleagues are able to push/clone from the same repo's I'm trying to access. Does anyone have an idea what could be causing this issue?
-
user3342582 over 8 yearsUnfortunately, that did not work. When I changed the config file from "fetch = +refs/heads/*:refs/remotes/new_repo/*" to "fetch = +refs/heads/:refs/remotes/origin/" and tried pushing, it gave me a fatal: Invalid refspec error.
-
Vamsi Ravi about 5 years@user3342582 Don't change/update the fetch value. Just update the url.