Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't git resolve the hostname when I push to a valid SSH address?

I am deploying an app on Heroku so I created a Heroku app from a repo and then did git push heroku master. When I do this it keeps giving me the error:

!  Your key with fingerprint xxx is not authorized to access heroku-app.

fatal: Could not read from remote repository.

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

I tried various things with changing my SSH keys including deleting them all and creating new ones. Still it gives me the same error. I have added the key to Heroku.

Then I tried running ssh -vT [email protected]:heroku-app.git and the result was:

OpenSSH_5.9p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 53: Applying options for *
ssh: Could not resolve hostname heroku.com:heroku-app.git: nodename nor servname provided, or not known

I cannot figure out what that error is pointing to. The hostname is definitely valid. Is it possible I am don't have something I need in the SSH config file? Any ideas would be fantastic because I have spent quite a few hours today trying to get this to work without avail.

like image 435
chromedude Avatar asked Jan 03 '13 03:01

chromedude


People also ask

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.

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 resolve hostname git name or service not known 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.


1 Answers

[email protected]:heroku-app.git is an SCP format for this ssh address.

It relies on a ~/.ssh/config file with a 'heroku.com' entry, which specify the user, the actual hostname, and if needed, the private/public key path.

host heroku.com
     user git
     hostname heroku.com
     identityfile ~/.ssh/yourPrivateKey

Again: heroku.com in 'heroku.com:heroku-app.git' is not an hostname: it is an entry in an ssh config file.
You could replace heroku.com by xxx: git push xxx:heroku-app.git, provided you have an xxx entry in the ~/.ssh/config file.

like image 196
VonC Avatar answered Sep 17 '22 16:09

VonC