【发布时间】:2014-06-30 03:57:12
【问题描述】:
我不知道我做了什么,但对我来说现在真是一团糟。 我正在尝试将我的 rails 应用程序代码推送到 heroku
git push heroku master
这个错误出现了:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
好的,现在我将尝试创建一个新的 ssh 密钥来修复它
sudo ssh-keygen -t rsa
我按了三下回车,然后我的 ssh 密钥就创建好了。
但是现在当我对 heroku 说“请添加这个新密钥”时:
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
Uploading SSH public key /Users/demarox/.ssh/id_rsa.pub... failed
! This key is already in use by another account. Each account must have a unique key.
我不明白发生了什么,也许计算机不是我的堡垒。而且我没有使用 github_rsa.pub 因为它给了我更多的 heroku 错误,而且似乎 id_rsa.pub 是所有人都使用的 ssh 密钥,所以我不想弄乱它。如何修复?
编辑:好的,也许这会有所帮助。此时我想把电脑扔出窗外。
Demarox:saga_plast_app demarox$ sudo git push heroku master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Demarox:saga_plast_app demarox$ sudo ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/var/root/.ssh/id_rsa):
/var/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/root/.ssh/id_rsa.
Your public key has been saved in /var/root/.ssh/id_rsa.pub.
The key fingerprint is:
f9:d0:45:80:4d:53:63:e5:36:38:60:80:ce:c8:1d:c9 root@Demarox.local
The key's randomart image is:
+--[ RSA 2048]----+
| . o.=*o=.. |
| E ...= + |
| . = . + + |
| o + o . o . |
| S . |
| o |
| . |
| |
| |
+-----------------+
Demarox:saga_plast_app demarox$ 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
Uploading SSH public key /Users/demarox/.ssh/id_rsa.pub... failed
! This key is already in use by another account. Each account must have a unique key.
Demarox:saga_plast_app demarox$ heroku keys:clear
Removing all SSH keys... done
Demarox:saga_plast_app demarox$ heroku keys
You have no keys.
Demarox:saga_plast_app demarox$ 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
Uploading SSH public key /Users/demarox/.ssh/id_rsa.pub... failed
! This key is already in use by another account. Each account must have a unique key.
【问题讨论】:
-
我认为您需要了解 SSH。首先,阅读本教程:support.suso.com/supki/SSH_Tutorial_for_Linux 然后,检查这个 stackoverflow 问题(我知道你没有使用多个 Heroku 帐户,但如果你使用 SSH 的多个 any 帐户,这个问题很有帮助): stackoverflow.com/questions/4663103/multiple-heroku-accounts
标签: ruby-on-rails macos heroku terminal ssh-keys