Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ssh: Could not resolve hostname github.com: Name or service not known; fatal: The remote end hung up unexpectedly

Tags:

git

The process of setting up a GitHub account works just fine but it doesn't work when I try pushing my repository to GitHub. The error message it shows is as follows:

ssh: Could not resolve hostname github.com: Name or service not known fatal: The remote end hung up unexpectedly 

I have tried changing RSA keys and all but still getting error.

What causes this error?

like image 286
Neel Pathak Avatar asked Feb 22 '12 10:02

Neel Pathak


People also ask

Could not resolve hostname SSH GitHub com name or service not known fatal could not read from remote repository?

You may be getting this error because you generated an ssh for your local machine and didn't add it to your GitHub account or because you added an ssh key to your GitHub account. This may also happen for some other reasons.

How do I find my GitHub hostname?

From an administrative account on GitHub Enterprise Server, in the upper-right corner of any page, click . If you're not already on the "Site admin" page, in the upper-left corner, click Site admin. In the left sidebar, click Management Console. In the left sidebar, click Hostname.

What does could not resolve host mean?

What is the meaning of error: 'Unable to resolve host name'? This error means that the hostname you are trying to connect to cannot be resolved to an IP address. (Hostnames are resolved to IP addresses by a DNS (Domain NameServer)). Please check what you have entered in the Address field.


2 Answers

Recently, I have seen this problem too. Below, you have my solution:

  1. ping github.com, if ping failed. it is DNS error.
  2. sudo vim /etc/resolv.conf, the add: nameserver 8.8.8.8 nameserver 8.8.4.4

Or it can be a genuine network issue. Restart your network-manager using sudo service network-manager restart or fix it up

like image 174
Qiangks Avatar answered Sep 21 '22 15:09

Qiangks


I have just received this error after switching from HTTPS to SSH (for my origin remote). To fix, I simply ran the following command (for each repo):

ssh -T [email protected]

Upon receiving a successful response, I could fetch/push to the repo with ssh.

I took that command from Git's Testing your SSH connection guide, which is part of the greater Connecting to GitHub with with SSH guide.

like image 34
Todd Avatar answered Sep 20 '22 15:09

Todd