git Heroku 错误:“权限被拒绝(公钥)”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3481973/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 08:53:45  来源:igfitidea点击:

Heroku error: "Permission denied (public key)"

gitconfigurationheroku

提问by picardo

I keep getting this error. I am using Mac. I generated a key and added it to heroku using

我不断收到此错误。我正在使用 Mac。我生成了一个密钥并将其添加到 heroku 使用

heroku config:add key="ssh-rsa [email protected]"

heroku config:add key="ssh-rsa [email protected]"

But this doesn't work. I keep getting the same error. Short of reinstalling ssh-keygen, what can I do about this?

但这不起作用。我不断收到同样的错误。如果没有重新安装 ssh-keygen,我该怎么办?

回答by Sathish

Try heroku keys:add <path-to-your-public-key>.

试试heroku keys:add <path-to-your-public-key>

For example, heroku keys:add ~/.ssh/id_rsa.pub

例如, heroku keys:add ~/.ssh/id_rsa.pub

回答by Abram

the solution above did not work for me as I did not have any keys generated in my ~/.ssh folder.

上面的解决方案对我不起作用,因为我的 ~/.ssh 文件夹中没有生成任何密钥。

My solution was to simply type heroku keys:add

我的解决方案是简单地输入 heroku keys:add

The output in terminal was:

终端的输出是:

Could not find an existing public key.
Would you like to generate one? [Yn] y
Generating new SSH public key.
Uploading SSH public key /home/funkdified/.ssh/id_rsa.pub... done

See: https://devcenter.heroku.com/articles/keys

请参阅:https: //devcenter.heroku.com/articles/keys

回答by rockstar

i faced the same issue . Writing my experience so it helps someone else .

我遇到了同样的问题。写下我的经验,以帮助其他人。

I tried to follow the instructions that were detialed on the official website -Getting Started with Your Facebook App on Heroku

我尝试按照官方网站上的说明进行操作 -在 Heroku 上开始使用您的 Facebook 应用程序

Even though it is quite detialed especially the video it is quite annoying to note that they do not mention having to set up SSH keys . Either it is set by default ( i dont know ) or you get the error mentioned by the question poster .

尽管它非常详细,尤其是视频,但注意到他们没有提到必须设置 SSH 密钥还是很烦人的。要么默认设置(我不知道),要么您收到问题发布者提到的错误。

So i did the following :

所以我做了以下事情:

1 . opened up the git shell

1 . 打开 git shell

2 . typed the following in

2 . 输入以下内容

C:\Users\blue\Documents\GitHub> heroku keys:add
Found the following SSH public keys:
1) github_rsa.pub
2) id_rsa.pub
Which would you like to use with your Heroku account? 2

3 . Subsequent to this i was able to getcheckout my repository

3 . 在此之后,我能够查看我的存储库

C:\Users\blue\Documents\GitHub> heroku login
Enter your Heroku credentials.
Email: [email protected]
Password (typing will be hidden):
Authentication successful.
C:\Users\blue\Documents\GitHub> git clone [email protected]:sxxxd-plains-8530.gi
t
Cloning into 'sxxxd-plains-8530'...
Warning: Permanently added 'heroku.com,50.19.85.154' (RSA) to the list of known
hosts.
remote: Counting objects: 180, done.
remote: Compressing objects: 100% (112/112), done.
remote: Total 180 (delta 82), reused 132 (delta 62)
Receiving objects:  81% (146/180), 76.00 KiB | 62 KiB/s
Receiving objects: 100% (180/180), 137.91 KiB | 62 KiB/s, done.
Resolving deltas: 100% (82/82), done.
C:\Users\blue\Documents\GitHub>

Please dont downvote my answer . Even though i dont add any new value to what is already posted but i hope my experiences will help someone who is new to using git & heruko . Hence i added screen shots .

请不要低估我的回答。尽管我没有为已经发布的内容添加任何新的价值,但我希望我的经验能帮助那些不熟悉使用 git & heruko 的人。因此我添加了屏幕截图。

  • My 2 cents
  • 我的 2 美分

回答by Ryan Watts

Copy the files in your .ssh path ex:

复制 .ssh 路径中的文件,例如:

/c/Users/<yourusername>/.ssh/<files>

to the git .ssh folder.

到 git .ssh 文件夹。

/c/Program Files/Git/.ssh/<paste files here>

If the .ssh folder doesn't exist in the Git directory simply create it then paste your files.

如果 .ssh 文件夹在 Git 目录中不存在,只需创建它然后粘贴您的文件。

For some reason windows require that a .ssh path be in the user directory as well as the Git directory. ON default this is not added so you simply have to create it yourself.

出于某种原因,Windows 要求 .ssh 路径位于用户目录和 Git 目录中。默认情况下不会添加此项,因此您只需自己创建即可。

After adding the files to Git's directory simply run the following command again:

将文件添加到 Git 目录后,只需再次运行以下命令:

git push heroku master

回答by przbadu

if you dont have ssh key yet then try generating it using below command :

如果您还没有 ssh 密钥,请尝试使用以下命令生成它:

1. ssh-keygen -t rsa -C "[email protected]"
2. ssh-add

For getting rid of heroku permission denied (public key) add your keys to heroku using:

要摆脱 heroku 权限被拒绝(公钥),请使用以下命令将您的密钥添加到 heroku:

3. heroku keys:add <path_to_your_ssh>
    OR
 heroku keys:add

For getting rid of Github permission denied (public key) add your keys to Github using:

要摆脱 Github 权限被拒绝(公钥),请使用以下方法将您的密钥添加到 Github:

4. ssh-add <path_to_your_ssh> 
     OR
  ssh-add

回答by aaandre

This could also indicate API issues. Make sure to check https://status.heroku.com

这也可能表明 API 问题。确保检查https://status.heroku.com