当我推送到有效的SSH地址时,为什么不能解析主机名? [英] Why can't git resolve the hostname when I push to a valid SSH address?

查看:540
本文介绍了当我推送到有效的SSH地址时,为什么不能解析主机名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Heroku上部署应用程序,所以我从回购库创建了一个Heroku应用程序,然后执行 git push heroku master 。当我这样做时,它一直给我错误:

 !指纹xxx的密钥无权访问heroku-app。 

致命:无法从远程存储库读取。

请确保您拥有正确的访问权限
并存在存储库。

我尝试了更改我的SSH密钥的各种方法,包括全部删除它们并创建新密钥。它仍然给我同样的错误。

然后我尝试运行 ssh -vT git@heroku.com:heroku-app.git c $ c>,结果是:

  OpenSSH_5.9p1,OpenSSL 0.9.8r 2011年2月8日
debug1:读取配置数据/ etc / ssh_config
debug1:/ etc / ssh_config第20行:为*
应用选项debug1:/ etc / ssh_config第53行:为*
应用选项ssh:无法解析hostname heroku.com:heroku-app.git:nodename,也不提供servname,或不知道

我无法找出那个错误指向的是什么。主机名绝对有效。是否有可能在SSH配置文件中没有我需要的东西?任何想法都会很棒,因为我今天花了好几个小时试图让这个工作无效。 解决方案

git@heroku.com:heroku-app.git SCP格式对于这个ssh地址。

它依靠一个带有'heroku.com的〜/ .ssh / config 文件'entry,它指定用户,实际的主机名,如果需要的话,私人/公共密钥路径。

  host heroku。 com 
user git
hostname heroku.com
identityfile〜/ .ssh / yourPrivateKey

同样: heroku.com 位于< heroku.com:heroku-app.git 不是主机名:它是ssh配置文件中的一个条目。

您可以用<$ c替换 heroku.com 如果您在〜〜中有一个xxx条目,则可以使用$ c> xxx git push xxx:heroku-app.git /.ssh/config 文件。


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.

解决方案

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.

这篇关于当我推送到有效的SSH地址时,为什么不能解析主机名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆