Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not resolve hostname git: nodename nor servname provided, or not known

Tags:

git

I tried doing git pull --rebase and I am getting the following error:

ssh: Could not resolve hostname git: nodename nor servname provided, or not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I tried doing git remote -v and the origin is properly listed.

How can I fix this error?

like image 467
Kermit the Frog Avatar asked Dec 17 '13 19:12

Kermit the Frog


People also ask

Can't resolve hostname no such host is known?

In some cases, you're going to inevitably come across errors. And one such error is the “So Such Host is Known” error. As and when you get such error, it implies that either the server is down or the hostname is incorrect and hence SSH wasn't able to connect to it.

Could not establish connection could not resolve hostname?

This error indicates that your hostname failed to translate into an IP address. Usually, this error occurs when you change the hostname of your system. Please check the details in the Address field as entered by you. Also, check if the hostname of your FTP server and IP address is correct.

How do I change my github remote?

Switching remote URLs from HTTPS to SSH Change the current working directory to your local project. List your existing remotes in order to get the name of the remote you want to change. Change your remote's URL from HTTPS to SSH with the git remote set-url command. Verify that the remote URL has changed.


2 Answers

I have recently solved this issue by removing ssh from the remote address on my fork:

origin  ssh://[email protected]:yunus/client.git (fetch)
origin  ssh://[email protected]:yunus/client.git (push)
...

updated as:

origin  [email protected]:yunus/client.git (fetch)
origin  [email protected]:yunus/client.git (push)
...
like image 112
Yunus Nedim Mehel Avatar answered Nov 15 '22 22:11

Yunus Nedim Mehel


Just add the hostname to /etc/hosts file

# IP       hostname
1.55.4.5.66 [email protected]
like image 23
Junius L. Avatar answered Nov 15 '22 22:11

Junius L.