部署 Heroku 代码时权限被拒绝(公钥)。 fatal:远端意外挂断

发布于 2024-10-04 02:00:27 字数 235 浏览 1 评论 0原文

我尝试使用以下命令行将我的代码部署到 heroku:

git push heroku master

但出现以下错误:

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

我已经上传了我的公共 SSH 密钥,但仍然出现此错误。

I'm attempting to deploy my code to heroku with the following command line:

git push heroku master

but get the following error:

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

I have already uploaded my public SSH key, but it still comes up with this error.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(30

时间你老了 2024-10-11 02:00:28

这对我来说是解决方案:

ssh-add ~/.ssh/my_heroku_key_rsa

This was the solution for me:

ssh-add ~/.ssh/my_heroku_key_rsa
冰雪梦之恋 2024-10-11 02:00:28

分享我的经验:

Git(我自己安装的)正在寻找名为“id_rsa”的密钥。

因此,我尝试将我的密钥重命名为“id_rsa”和“id_rsa.pub”并且成功了。

顺便说一句,我确信还有其他方法可以做到这一点,但我还没有更深入地研究。

To share my experience :

Git (my own install) was looking for the key named 'id_rsa'.

So I tried to rename my keys to 'id_rsa' and 'id_rsa.pub' and it worked.

Btw, I'm sure there is an other way to do it but I didn't look deeper yet.

猫九 2024-10-11 02:00:28

如果您已经上传了密钥,请尝试删除密钥,然后重新上传
用新钥匙。

 heroku keys:remove //removes the existing key
 ssh-keygen -t rsa //generates a new key in ~/.ssh folder
 heroku keys:add    //uploads the new key, if no arguments r passed then the key generated                              
                    //in default directroy i.e., ~/.ssh/id_rsa is uploaded
 git push heroku

这应该有效。

If you've already uploaded the key then try to remove the key and then re-upload
it with a new key.

 heroku keys:remove //removes the existing key
 ssh-keygen -t rsa //generates a new key in ~/.ssh folder
 heroku keys:add    //uploads the new key, if no arguments r passed then the key generated                              
                    //in default directroy i.e., ~/.ssh/id_rsa is uploaded
 git push heroku

this should work.

ㄟ。诗瑗 2024-10-11 02:00:28

我花了 3 天的时间尝试了所有可能的组合来让它发挥作用——最后我尝试制作一个 DSA 密钥,它成功了。

如果 DSA 不适合您,请尝试使用 DSA 而不是 RSA。

(我使用的是 Ubuntu 11.10、ruby 1.8.7、heroku 2.15.1)

I killed myself for 3 days trying every possible combination to try to get this to work -- I finally tried making a DSA key instead and it worked.

Try DSA instead of RSA if it's not working for you.

(I'm using Ubuntu 11.10, ruby 1.8.7, heroku 2.15.1)

看海 2024-10-11 02:00:28

在 Windows 7,64 位上,上述解决方案(Onur Turhan 的)对我有用,稍作更改如下

C:\Users\MyName > heroku login

输入电子邮件/密码

C:\Users\MyName >ssh-keygen -t rsa -f id_rsa

这在我的 c:\Users\MyName 目录(不在 . ssh 目录)

heroku keys:add id_rsa.pub
git clone [email protected]:some-heiku-xxxx.git -o heroku

我想添加正确的“id_rsa.pub”文件是最重要的。使用 keygen 生成公钥后,只需通过查看创建时的时间戳来验证您是否添加了正确的密钥。

On Windows 7,64 bit,the above solution (Onur Turhan's) worked for me with slight changes as below

C:\Users\MyName > heroku login

Enter email/password

C:\Users\MyName >ssh-keygen -t rsa -f id_rsa

This generated two files(id_rsa and id_rsa.pub) in my c:\Users\MyName directory (Not in .ssh directory)

heroku keys:add id_rsa.pub
git clone [email protected]:some-heiku-xxxx.git -o heroku

I guess adding the correct "id_rsa.pub" file is the most important.After generating the public key using keygen just verify that you are adding correct key by looking at the time-stamp when it was created.

江南月 2024-10-11 02:00:28

一个命令就可以工作:

heroku keys:add

如果它不存在,它就会创建一个。

One single command works:

heroku keys:add

It will make one if it doesn't exist.

極樂鬼 2024-10-11 02:00:28

当我的机器上安装 TortoiseGIT 时,我遇到了这个问题。将环境变量 GIT_SSH 从 更改为 并按照本教程使用 ssh-keygenkeys:add

"c:\Program Files\TortoiseGit\bin\TortoisePlink.exe"

"c:\Program Files (x86)\Git\bin\ssh.exe"

它就可以工作了!

I had this problem when TortoiseGIT was installed on my machine. After changing the environment variable GIT_SSH from

"c:\Program Files\TortoiseGit\bin\TortoisePlink.exe"

to

"c:\Program Files (x86)\Git\bin\ssh.exe"

and following this tutorial with ssh-keygen and keys:add, it works!

独孤求败 2024-10-11 02:00:28

推动对我来说很有效,然后突然停止了。

如果heroku api遇到停机,您在尝试推送时将会收到此错误。

检查:

https://status.heroku.com/

,然后再惊慌失措。

Pushing was working for me and then stopped suddenly.

If the heroku api is experiencing downtime, you will get this error when you try to push.

Check:

https://status.heroku.com/

before freaking out too hard.

归属感 2024-10-11 02:00:28

接下来的顺序

$ heroku login
$ ssh-keygen -t rsa
$ heroku keys:add

当执行第二条语句时,它会要求输入,只需按 Enter(回车)三次,就会添加一个键。

Sequence to follow

$ heroku login
$ ssh-keygen -t rsa
$ heroku keys:add

When executing second statement it would ask for input, just press Enter(return) three times and a key will be added.

留蓝 2024-10-11 02:00:28

上面给出的答案确实有效,但发现我需要执行一些额外的步骤才能起作用。

  1. 我删除了所有 id_rsa* 文件并使用指南生成了新的 SSH。
  2. 然后,我毁掉了heroku应用程序。删除了 ~/.heroku/credentials 文件。
  3. “heroku create”命令(由于凭证文件已被删除,它会提示您输入电子邮件/密码。
  4. 最后输入“heroku keys:add”,它将上传默认的 ~/.ssh/id_rsa.pub 文件。
  5. 它可以工作嗯...YMMV,但我真的希望这能有所帮助,因为我一整天都在努力解决这个问题,哈哈!

The above given answer DOES work, but found out I needed to do some extra steps before it worked.

  1. I removed all id_rsa* files and generated a new SSH using this guide.
  2. Then, I destroyed the heroku app. Removed the ~/.heroku/credentials file.
  3. 'heroku create' command (and since the credentials file is removed, it will prompt you for your email/password.
  4. FINALLY type 'heroku keys:add' and it will upload the default ~/.ssh/id_rsa.pub file.
  5. It works! Well.... YMMV but I really do hope this can be some help as I struggled the whole day trying to figure this out! Haha
娜些时光,永不杰束 2024-10-11 02:00:28

对于所有在 Windows 7 上尝试了上述所有操作但仍然不起作用的人,以下是我所做的:
- 从 Git 目录 C:\Program Files (x86)\Git\ 打开 GitBash.exe(不要打开命令提示符,这不起作用)。
- 添加以下内容上面,但你必须删除 #

Host heroku.com
Hostname heroku.com 
Port 22 
IdentitiesOnly yes 
IdentityFile ~/.ssh/ssh-dss
TCPKeepAlive yes 
User [email protected]

now run git push heroku master它应该可以工作。

For all those who tried everything mentioned above on Windows 7 and still it didn't work, here is what I've done:
- open GitBash.exe from the Git directory C:\Program Files (x86)\Git\ (don't open a command prompt, this won't work).
- add the following as mentioned above, but you have to delete the #

Host heroku.com
Hostname heroku.com 
Port 22 
IdentitiesOnly yes 
IdentityFile ~/.ssh/ssh-dss
TCPKeepAlive yes 
User [email protected]

now run git push heroku master and it should work.

伊面 2024-10-11 02:00:28

听起来您的 ~/.ssh/authorized_keys 文件设置不正确。验证:

  • 它位于正确的路径中。
  • 该文件的权限是0600。
  • ~/.ssh的权限是0700。

It sounds like your ~/.ssh/authorized_keys file is not set up correctly. Verify that:

  • It is in the correct path.
  • The permissions of the file are 0600.
  • The permissions of ~/.ssh are 0700.
十秒萌定你 2024-10-11 02:00:28

我必须这样做:

$ ssh-keygen -t rsa  
$ heroku keys:add  

然后它起作用了:

$ git push heroku master  

I had to do:

$ ssh-keygen -t rsa  
$ heroku keys:add  

Then it worked:

$ git push heroku master  
梦罢 2024-10-11 02:00:28

检查 heroku 的 .ssh 配置。转到 .ssh 文件夹并打开配置文件

cd ~/.ssh
subl config

“subl”适用于 Sublime Text,但您可以使用任何您想要的编辑器。查找“IdentityFile”行并确保它列出了非公钥:

IdentityFile "/Users/ircmullaney/.ssh/my_ssh"

不是

IdentityFile "/Users/ircmullaney/.ssh/my_ssh.pub"

这对我来说是这样。我不确定为什么我的配置文件中有公共版本,但它确实存在并且抛出了错误:

Permissions 0644 for '/Users/ircmullaney/.ssh/my_ssh.pub' are too open.

Check your .ssh config for heroku. Go to the .ssh folder and open the config file

cd ~/.ssh
subl config

The 'subl' is for Sublime Text, but you can use whatever editor you wish. Look for the line "IdentityFile" and make sure it has the non public key listed:

IdentityFile "/Users/ircmullaney/.ssh/my_ssh"

not

IdentityFile "/Users/ircmullaney/.ssh/my_ssh.pub"

That did it for me. I'm not sure why mine had the public version in the config file, but it did and it was throwing the error:

Permissions 0644 for '/Users/ircmullaney/.ssh/my_ssh.pub' are too open.
初见 2024-10-11 02:00:28

在尝试了所有这些想法后我仍然遇到问题。这是我的问题:

我的远程 Heroku 存储库被吓坏了。我刷新如下:

git remote -v

然后删除错误的 Heroku 一个:

git remote rm heroku

然后添加新的

git remote add heroku [email protected]:sitename.git

您可以从应用程序的 Heroku 设置页面获取站点名称。祝你好运!

I was still having problems after trying all of these ideas. This was my problem:

My remote heroku repository was funked. I refreshed it as follows:

git remote -v

Then remove the heroku one that is wrong:

git remote rm heroku

Then add the new one

git remote add heroku [email protected]:sitename.git

You can get the sitename from your Heroku settings page for your app. Good Luck!

蘸点软妹酱 2024-10-11 02:00:28

我遇到的问题是在 Windows 上,每当我运行“heroku keys:add”时,它总是选择 github 密钥。因此,这是我解决问题所遵循的步骤,

  1. 转到“文档和设置”文件夹下的 .ssh 目录并删除 git hub 密钥,
  2. 运行命令
    heroku keys:add

上面的命令要求我生成一个新的密钥,以下是输出
找不到现有的公钥。
您想生成一个吗? [Yn] 是
生成新的 SSH 公钥。
正在上传 SSH 公钥 C:/Documents and Settings/Admin/.ssh/id_rsa.pub... 完成
! ‘heroku’ gem 已被弃用并被 Heroku Toolbelt 取代,从 https://toolbelt.heroku.com< 下载并安装/a>.

  1. 重新运行命令
    heroku keys:add

上面的命令不会给出以下输出
找到现有的公钥:C:/Documents and Settings/Admin/.ssh/id_rsa.pub
上传 SSH 公钥 C:/Documents and Settings/Admin/.ssh/id_rsa.pub... 完成

  1. 现在使用 git push heroku master

使用上述步骤解决了问题,并能够在云上部署应用程序。

The problem I faced was on Windows and invariably whenever I run the "heroku keys:add" it selected the github keys. So here are the steps I followed to resolve the issue

  1. went to the .ssh directory under "Document and Settings" folder and deleted the git hub keys
  2. run the command
    heroku keys:add

The above command asked me to generate a new keys and following was the output
Could not find an existing public key.
Would you like to generate one? [Yn] Y
Generating new SSH public key.
Uploading SSH public key C:/Documents and Settings/Admin/.ssh/id_rsa.pub... done
! The 'heroku' gem has been deprecated and replaced with the Heroku Toolbelt, download and install from https://toolbelt.heroku.com.

  1. rerun the command
    heroku keys:add

The above command will not give the following output
Found existing public key: C:/Documents and Settings/Admin/.ssh/id_rsa.pub
Uploading SSH public key C:/Documents and Settings/Admin/.ssh/id_rsa.pub... done

  1. Now use the git push heroku master

for me using the above steps solved the issue and was able to deploy the application on the cloud.

梦过后 2024-10-11 02:00:28

我遇到了同样的问题;遵循以下步骤应该会有所帮助:

  1. 首先,登录:heroku login
  2. 清除所有密钥:heroku keys:clear
  3. 删除本地文件夹中的所有文件(所有 .pub 文件和 know_host.ssh/文件夹
  4. 再次登录:heroku登录 - u将提示没有密钥,因此请按照屏幕上的说明进行操作。

I was experiencing the same problem; following these steps should help:

  1. First, log in: heroku login
  2. Clear all keys: heroku keys:clear
  3. Delete all files in local folder ( all .pub files and know_host) in .ssh/ folder
  4. Log in again : heroku login - u will prompt with no key, so follow the onscreen instructions.
在梵高的星空下 2024-10-11 02:00:28

我想补充一点,该目录不一定是 C:\Users\[用户名]\.ssh。它是您在其中创建公钥的目录。

例如,我在 Windows 中的主目录已更改为 C:\[用户名]。 .ssh 子文件夹中的主目录是您创建密钥的最佳且最有可能的位置。您可以使用以下命令检查 Windows 中的主目录:

    echo %HOMEPATH%

I would just to like to add that the directory is not necessarily C:\Users\[username]\.ssh. It is the directory in which you created your public key in.

For instance my home directory in Windows was changed to C:\[username]. Your home directory in a .ssh sub-folder is the best and most likely place you may have created your keys. You can check your home directory in Windows with the command:

    echo %HOMEPATH%
亽野灬性zι浪 2024-10-11 02:00:28

如果您想使用“sudo”,例如:

sudo git clone [email protected]......... -o heroku

您还应该为 root 用户生成 ssh 密钥。

sudo su
cd /root/.ssh  
ssh-keygen -t rsa
....
heroku keys:add id_rsa.pub

它会起作用的。

如果您不使用 root 用户,请在您的用户目录中生成 ssh 密钥。

cd /home/user/.ssh

抱歉,如果我的句子混乱了......

If you want to use "sudo", example:

sudo git clone [email protected]......... -o heroku

you should also generate ssh key for your root user.

sudo su
cd /root/.ssh  
ssh-keygen -t rsa
....
heroku keys:add id_rsa.pub

and it'll work.

if you don't use root user, generate ssh key in your user directory instead.

cd /home/user/.ssh

Sorry if my sentences messed up...

溺孤伤于心 2024-10-11 02:00:28

尝试在“磁盘工具”(Mac OS X) 中修复权限。帮助了我

Try repairing permissions in Disk Utility (Mac OS X). Helped me

皇甫轩 2024-10-11 02:00:28

首先确保隐藏的文件在您的 Mac 中可见。
如果没有,请执行以下操作:

  • 打开终端并输入 defaults write com.apple.Finder
    AppleShowAllFiles TRUE
  • killall Finder

后续步骤:

  • 转到Users/user_name/.ssh/ 删除所有文件。
  • ssh-keygen -t dsa 中打开终端类型,
  • 然后 heroku keys:add ~/.ssh/id_dsa.pub

注意,我是在 Mac OSX 10.7.2 Lion 中完成的。尽管其他人的程序也应该相同。

At first make sure hidden files are visible in your Mac.
If not do:

  • Open terminal and type in defaults write com.apple.Finder
    AppleShowAllFiles TRUE
  • killall Finder

Next steps:

  • Going to Users/user_name/.ssh/ removed all the files.
  • Opening terminal type in ssh-keygen -t dsa
  • Then heroku keys:add ~/.ssh/id_dsa.pub

N.B. I did it in Mac OSX 10.7.2 Lion. Though the procedure should be same in others too.

混吃等死 2024-10-11 02:00:28

我也有这个问题。我使用的是 Mac OSX。我解决这个问题的方法是以管理员身份登录

须藤苏

密码

I have this issue as well. I am using Mac OSX. The way I fixed that was to login as admin

sudo su

password

生生不灭 2024-10-11 02:00:28

dmajkic 的解决方案终于帮助了我:

对于 Windows 用户,这可能意味着:git 客户端找不到你的密钥。
检查 c:\Users\UserName.ssh\ 中的密钥并且!环境变量HOME=c:\Users\用户名\

Solution of dmajkic help me at last:

For Windows users it may means: git client coudn’t find your keys.
Check keys in c:\Users\UserName.ssh\ and! environment variable HOME=c:\Users\UserName\

幸福%小乖 2024-10-11 02:00:28

这对我有用。 heroku 站点未添加到您的已知主机中。转到 window-other-show view-git-git 存储库。从那里克隆存储库。克隆它后,删除刚刚创建的存储库,然后从文件菜单导入它。执行此操作是因为当您克隆存储库时,它不会将其添加到资源管理器视图中。现在您应该拥有 git 存储库和资源管理器视图。

Here is what worked for me. The heroku site is not being added to your known hosts. Go to window-other- show view-git-git repositories. From there clone the repository. Once you clone it, delete the repository that was just created and then import it from the file menu. Do this since when you clone the repository, it does not add it to the explorer view. Now you should have the git repository and the explorer view.

成熟的代价 2024-10-11 02:00:27

您必须将公钥上传到 Heroku:

heroku keys:add ~/.ssh/id_rsa.pub

如果您没有公钥,Heroku 会提示您自动添加一个,这样可以无缝运行。只需使用:

heroku keys:add

要清除以前的所有键,请执行以下操作:

heroku keys:clear

要显示所有现有的键,请执行以下操作:

heroku keys

编辑:

上面的内容似乎对我不起作用。我搞乱了 HOME 环境变量,因此 SSH 在错误的目录中搜索密钥。

为了确保 SSH 在正确的目录中检查密钥,请执行以下操作:

ssh -vT [email protected]

这将显示以下(示例)行

OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Connecting to heroku.com [50.19.85.156] port 22.
debug1: Connection established.
debug1: identity file /c/Wrong/Directory/.ssh/identity type -1
debug1: identity file /c/Wrong/Directory/.ssh/id_rsa type -1
debug1: identity file /c/Wrong/Directory/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version Twisted
debug1: no match: Twisted
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Host 'heroku.com' is known and matches the RSA host key.
debug1: Found key in /c/Wrong/Directory/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /c/Wrong/Directory/.ssh/identity
debug1: Trying private key: /c/Wrong/Directory/.ssh/id_rsa
debug1: Trying private key: /c/Wrong/Directory/.ssh/id_dsa
debug1: No more authentication methods to try.

Permission returned (publickey).

从上面您可以观察到ssh 在 /c/Wrong/Directory/.ssh 目录中查找密钥,该目录不是我们刚刚添加到 heroku 的公钥的位置(使用 heroku keys:add ~/ .ssh/id_rsa.pub ) ( 请注意,在 Windows 操作系统中 ~ 指的是 HOME 路径,在 win 7 / 8 中为 C:\Users\UserName )

要查看当前主目录,请执行以下操作: echo $HOMEecho %HOME% (Windows

)正确设置您的 HOME 目录(我的意思是 .ssh 目录的父目录,以便 ssh 可以在正确的目录中查找密钥)请参阅以下链接:

  1. 关于如何设置 Unix 的答案环境变量永久

  2. 关于 ssh 在错误目录中查找密钥的问题以及相同的解决方案。

You have to upload your public key to Heroku:

heroku keys:add ~/.ssh/id_rsa.pub

If you don't have a public key, Heroku will prompt you to add one automatically which works seamlessly. Just use:

heroku keys:add

To clear all your previous keys do :

heroku keys:clear

To display all your existing keys do :

heroku keys

EDIT:

The above did not seem to work for me. I had messed around with the HOME environment variable and so SSH was searching for keys in the wrong directory.

To ensure that SSH checks for the key in the correct directory do :

ssh -vT [email protected]

Which will display the following ( Sample ) lines

OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Connecting to heroku.com [50.19.85.156] port 22.
debug1: Connection established.
debug1: identity file /c/Wrong/Directory/.ssh/identity type -1
debug1: identity file /c/Wrong/Directory/.ssh/id_rsa type -1
debug1: identity file /c/Wrong/Directory/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version Twisted
debug1: no match: Twisted
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Host 'heroku.com' is known and matches the RSA host key.
debug1: Found key in /c/Wrong/Directory/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /c/Wrong/Directory/.ssh/identity
debug1: Trying private key: /c/Wrong/Directory/.ssh/id_rsa
debug1: Trying private key: /c/Wrong/Directory/.ssh/id_dsa
debug1: No more authentication methods to try.

Permission denied (publickey).

From the above you could observe that ssh looks for the keys in the /c/Wrong/Directory/.ssh directory which is not where we have the public keys that we just added to heroku ( using heroku keys:add ~/.ssh/id_rsa.pub ) ( Please note that in windows OS ~ refers to the HOME path which in win 7 / 8 is C:\Users\UserName )

To view your current home directory do : echo $HOME or echo %HOME% ( Windows )

To set your HOME directory correctly ( by correctly I mean the parent directory of .ssh directory, so that ssh could look for keys in the correct directory ) refer these links :

  1. SO Answer on how to set Unix environment variable permanently

  2. SO Question regarding ssh looking for keys in the wrong directory and a solution for the same.

满栀 2024-10-11 02:00:27

我遇到了同样的问题,以下步骤对我有用,

->heroku login

[电子邮件受保护] &密码

->cd C:\Users\yourusername\.ssh    (OR for cygwin shell ->cd ~/.ssh)

->ssh-keygen -t rsa -f id_rsa

如果询问任何密码短语,请勿使用空白,请填写密码短语,但不要忘记。

生成密钥后,您需要添加它,就像这样

$ ssh-add

,并将其添加到 heroku

->heroku keys:add "id_rsa.pub"

将目录更改为工作区,而不是

->git clone [email protected]:stark-dawn-1234.git -o heroku

使用上面设置的密码。


实际上我也删除了下面的文件,但不确定它们是 imp,

C:\Users\yourusername.heroku\credientals 和 C:\Users\yourusername.ssh\known_hosts

I had the same issue, the steps below worked for me,

->heroku login

[email protected] & password

->cd C:\Users\yourusername\.ssh    (OR for cygwin shell ->cd ~/.ssh)

->ssh-keygen -t rsa -f id_rsa

if asks any passphrase don't use blank, fill with a passphrase,but not forget it.

After generating the key you need to add it, like so

$ ssh-add

and it to heroku

->heroku keys:add "id_rsa.pub"

change directory to workspace, than

->git clone [email protected]:stark-dawn-1234.git -o heroku

use passphrase that you set above.


Actually i also remove files below, but not sure that they are imp,

C:\Users\yourusername.heroku\credientals and C:\Users\yourusername.ssh\known_hosts

醉酒的小男人 2024-10-11 02:00:27

这个问题困扰了我几天。

这可能会有所帮助。

1) 找出您现在在 Heroku 中拥有哪些密钥。

$ heroku keys
=== 1 key for [email protected]
ssh-dss AAAAB8NzaC...DVj3R4Ww== [email protected]

2) 构建 ~/.ssh/config 文件:

$ sudo vim ~/.ssh/config

使用此信息进行编辑

Host heroku.com
Hostname heroku.com 
Port 22 
IdentitiesOnly yes 
IdentityFile ~/.ssh/ssh-dss # location and name of your private key
TCPKeepAlive yes 
User [email protected]

This problem was messing with me for a few days.

This might help.

1) Find out what keys you have in Heroku now.

$ heroku keys
=== 1 key for [email protected]
ssh-dss AAAAB8NzaC...DVj3R4Ww== [email protected]

2) Build a ~/.ssh/config file:

$ sudo vim ~/.ssh/config

Edit with this info

Host heroku.com
Hostname heroku.com 
Port 22 
IdentitiesOnly yes 
IdentityFile ~/.ssh/ssh-dss # location and name of your private key
TCPKeepAlive yes 
User [email protected]
梦幻之岛 2024-10-11 02:00:27

以下链接解释了如何管理 ssh 密钥: https:/ /devcenter.heroku.com/articles/keys#adding-keys-to-heroku

Here is the link that explains how to manage your ssh keys: https://devcenter.heroku.com/articles/keys#adding-keys-to-heroku

染墨丶若流云 2024-10-11 02:00:27

我遇到了同样的问题,因为我没有公钥,所以我这样做了:

heroku keys:clear
heroku keys:add

这将生成一个公钥,然后它运行良好

I had the same problem cause i had no public keys, so i did:

heroku keys:clear
heroku keys:add

That will generate a public key and then it works well

一直在等你来 2024-10-11 02:00:27

如果您是 Windows 用户,此处的其他解决方案可能无法解决您的问题。

我使用 Windows 7 64 位 + Git-1.7.7.1-preview20111027,解决方案是将我的密钥从 C:\users\user\.ssh 复制到 C:\Program Files ( x86)\Git\.ssh。这就是 git 客户端在推送到 heroku 时寻找密钥的地方。

我希望这有帮助。

If you are a windows user the other solutions here probably won't solve your problem.

I use Windows 7 64-Bit + Git-1.7.7.1-preview20111027 and the solution was to copy my keys from C:\users\user\.ssh to C:\Program Files (x86)\Git\.ssh. That's where this git client looks for the keys when pushing to heroku.

I hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文