git clone fails for Heroku project

有些话、适合烂在心里 提交于 2019-12-03 03:58:32

问题


(on Mac) I'm trying to clone my project from my new computer. I first generated the ssh key pairs:

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

heroku keys shows:

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

When I try to clone my project by 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. Somehow heroku doesn't like renaming my keys.. in other words, use the deault id_rsa.pub name.


回答1:


It looks like your key is not loaded. Only default named key (id_rsa) loaded by default. Load the heroku key by using ssh-add command:

ssh-add ~/.ssh/heroku_rsa



回答2:


I had a similar problem. At first, I did not have a key called id_rsa.pub. I only had a key for github: github_rsa.pub. I ran heroku keys and saw that it did recognize that I had a key. But apparently heroku does not like that github key. 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.




回答3:


heroku git:clone -a "your_project_name_on_heroku"

This simple command works fine (provided that your ssh key is correctly added before)



来源:https://stackoverflow.com/questions/7305673/git-clone-fails-for-heroku-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!