Reputation: 462
I was developing code on Ubuntu using VMware. Everything was fine, I was coding and committing it to my Github account without any problem. BUT suddenly it stopped working, it would say: fatal: unable to access 'https://github.com/hm0ss/nst.git/': Could not resolve host: github.com
What Have I done? I searched it on google and used config command and other advice, with no avail. I also made another git repository, but that failed either. I switched to GitLab and made a repository there, which had no benefit: "Unable to access 'https://gitlab.com/hma.globe/nst2.git/': Could not resolve host: gitlab.com" I need to say that I was using a proxy (socks indeed) but even disconnecting socks server (or removing proxies from google chrome) did not work either. By the way, I even switched to windows and tried to commit but came across to same error. After trying some 2 hours, I'm now in big trouble.
Upvotes: 8
Views: 51621
Reputation: 786
I had issues like this and there is no one specific set of instructions to resolve this. However I tried running this command and it worked for me
git config --global --unset http.proxy
Then run
git remote set-url origin <repository link>
After committing your new changes, try running this command if regular push gives you an error:
git push origin <branch> --force
Upvotes: 11
Reputation: 175
It's possible that GitHub's IP address isn't resolving correctly. Attempt to use a different DNS server temporarily to resolve the GitHub domain. You can change your DNS settings to a public DNS server like Google (8.8.8.8) or Cloudflare (1.1.1.1) to check if that resolves the issue.
For temporary DNS update:
sudo echo "nameserver 8.8.8.8" > /etc/resolv.conf
Other possible techniques for resolving:
restarting the VM/device
rechecking Firewall or Network Restrictions
restarting Network Services
sudo systemctl restart NetworkManager # For CentOS 8 and later
Upvotes: 3
Reputation: 11
For your additional information just in case you find this post. there are two scenario why it was happen First you enable your proxy so git --unset http.proxy
second you network using proxy so configure your proxy. which i found this useful answer
Upvotes: 0
Reputation: 1323743
Check first if the issue persists.
GitHub status has been reporting several issues recently (in the last few hours) which could explain "sudden" problems of yours.
For example: this incident: "We are investigating degradations to GitHub.com".
GitLab had no recent issues though, which means a network issue on your side could also be a factor.
The OP did a reset of the VMware to solve the network issue.
And a full reset to origin/master
+ copy of the current work to lake and push a new commit successfully to GitHub.
Upvotes: 1