简体   繁体   English

Heroku项目的git clone失败了

[英]git clone fails for Heroku project

(on Mac) I'm trying to clone my project from my new computer. (在Mac上)我正在尝试从我的新计算机克隆我的项目。 I first generated the ssh key pairs: 我首先生成了ssh密钥对:

heroku keys:add /Users/y/.ssh/heroku_rsa.pub

heroku keys shows: heroku keys显示:

ssh-rsa AAAAB3NzaC...B9DjpXg3fb y@server.local

When I try to clone my project by git clone git@heroku.com:xyz.git 当我尝试通过git clone git@heroku.com:xyz.git克隆我的项目时git clone git@heroku.com:xyz.git

Cloning into xyz...
Warning: Permanently added the RSA host key for IP address '50.19.85.132' to the list of known hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

This is strange. 这很奇怪。

EDIT: If I don't rename my pub key file then it works. 编辑:如果我不重命名我的pub密钥文件,那么它的工作原理。 Somehow heroku doesn't like renaming my keys.. in other words, use the deault id_rsa.pub name. 某种程度上,heroku不喜欢重命名我的密钥..换句话说,使用deault id_rsa.pub名称。

I had a similar problem. 我遇到了类似的问题。 At first, I did not have a key called id_rsa.pub. 起初,我没有一个名为id_rsa.pub的密钥。 I only had a key for github: github_rsa.pub. 我只有一个github的密钥:github_rsa.pub。 I ran heroku keys and saw that it did recognize that I had a key. 我跑了heroku keys ,看到它确实认出我有一把钥匙。 But apparently heroku does not like that github key. 但显然heroku不喜欢那个github密钥。 Here's what I did: 这是我做的:

$ssh-keygen -t rsa
$heroku keys:clear
$heroku keys:add 
$git clone git@heroku.com:my-app.git -o heroku

This downloaded all the files for the project successfully. 这成功下载了项目的所有文件。

It looks like your key is not loaded. 看起来您的密钥未加载。 Only default named key (id_rsa) loaded by default. 默认情况下仅加载默认的命名密钥(id_rsa)。 Load the heroku key by using ssh-add command: 使用ssh-add命令加载heroku密钥:

ssh-add ~/.ssh/heroku_rsa
heroku git:clone -a "your_project_name_on_heroku"

这个简单的命令工作正常(假设您的ssh密钥之前已正确添加)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM