Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ssh: Could not resolve hostname git: Name or service not known fatal: Could not read from remote repository

Tags:

After I switched from HTTPS to SSH for my repo then I received this error when pushing to origin master:

ssh: Could not resolve hostname git: Name or service not known
fatal: Could not read from remote repository.

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

I also add my ssh in the gitlab. What should I do?

like image 917
Majid Rajabi Avatar asked Nov 03 '18 08:11

Majid Rajabi


People also ask

Could not resolve hostname fatal could not read from remote repository?

The Git “fatal: Could not read from remote repository” error occurs when there is an issue authenticating with a Git repository. This is common if you have incorrectly set up SSH authentication. To solve this error, make sure your SSH key is in your keychain and you connecting to a repository using the correct URL.

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

ssh: Could not resolve hostname github.com: Temporary failure... fatal: Could not read from... 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.

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.


1 Answers

I was getting the same error.

Change the [remote "origin"] url value in .gitconfig or .config/git/config file

Previously:

https://[email protected]:userName/repo.git

OR

ssh://[email protected]:userName/repo.git

New:

[email protected]:userName/repo.git

like image 167
Shivam Sharma Avatar answered Sep 29 '22 03:09

Shivam Sharma