Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
561 views
in Technique[技术] by (71.8m points)

heroku - 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 git@heroku.com: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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

git@heroku.com: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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...