git clone heroku ssh 权限被拒绝
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3591084/
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
git clone heroku ssh permission denied
提问by Trip
I just bought a new computer and I am trying to clone my heroku project on it.
我刚买了一台新电脑,我想在上面克隆我的 heroku 项目。
Here's what I've done so far. I didn't include the trace, but everything was saved in the right place, and the functions ran without errors.
这是我到目前为止所做的。我没有包含跟踪,但所有内容都保存在正确的位置,并且函数运行没有错误。
>> sudo ssh-keygen
>> heroku keys:add
>> sudo git clone -o heroku [email protected]:myapp.git
Initialized empty Git repository in /Users/macuser/Sites/shwagr/shwagr/.git/
Permission denied (publickey).
Then I heard about doing it through ssh bash..
然后我听说通过 ssh bash 做这件事..
>ssh-agent bash
>ssh-add ~/.ssh
Permissions 0777 for '/Users/macuser/.ssh' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
What? Ok Dad..
什么?好的爸爸..
>>sudo chmod 700 ~/.ssh
>>ssh-agent bash
>>ssh-add ~/.ssh
Enter passphrase for /Users/macuser/.ssh:
Bad passphrase, try again for /Users/macuser/.ssh:
Bad passphrase, try again for /Users/macuser/.ssh:
Bad passphrase, try again for /Users/macuser/.ssh:
Bad passphrase, try again for /Users/macuser/.ssh:
Bad passphrase, try again for /Users/macuser/.ssh:
Bad passphrase, try again for /Users/macuser/.ssh:
Not sure what the password here is, but it sure wasn't me who set this one. If I simply press return/enter, it exits out, but that doesn't give me the impression it worked. And consequentially, it still doesn't allow me to clone the repository.
不知道这里的密码是什么,但肯定不是我设置的。如果我只是按回车/回车,它就会退出,但这并没有给我它有效的印象。因此,它仍然不允许我克隆存储库。
Any ideas?
有任何想法吗?
UPDATEI went into my ~/.ssh file and performed ssh-keygen -t rsa
and i made a new key called love
. Then I heroku keys:add love.pub
successfully.
更新我进入我的 ~/.ssh 文件并执行ssh-keygen -t rsa
,我创建了一个名为love
. 然后我heroku keys:add love.pub
成功了。
Then I went to git clone..
然后我去 git clone ..
sudo git clone -o heroku [email protected]:mysite.git
Initialized empty Git repository in /Users/macuser/Sites/shwagr/shwagr/.git/
Permission denied (publickey).
UPDATE 2
更新 2
I deleted ~/.ssh, and recreated it without sudo
. Then I removed all my keys I had created today off of heroku , and restarted the process.
我删除了 ~/.ssh,并在没有sudo
. 然后我从 heroku 中删除了我今天创建的所有密钥,并重新启动了这个过程。
Same error.
同样的错误。
Update 3
更新 3
>>heroku keys
No Keys for this computer.
>>sudo heroku keys
No Keys for this computer
>>heroku keys:add
>>heroku keys
ssh-rsa AAAA...J67lw== [email protected]
Compared these keys to my keys : They are identical. :D
将这些键与我的键进行比较:它们是相同的。:D
Permission Denied.
没有权限。
Attempt 4
尝试 4
heroku keys:clear rm -rf ~/.ssh mkdir ~/.ssh cd ~/.ssh ssh-keygen -t rsa heroku keys:add cd /Users/macuser/Sites/ sudo git clone -o heroku [email protected]:shwagr.git
heroku 密钥:clear rm -rf ~/.ssh mkdir ~/.ssh cd ~/.ssh ssh-keygen -t rsa heroku 密钥:添加 cd /Users/macuser/Sites/ sudo git clone -o heroku [email protected] :shwagr.git
Failed.
失败的。
fatal: The remote end hung up unexpectedly
致命:远端意外挂断
Huge Update
重大更新
Just found out that git repo is actually empty. And it's just a symbolic link ( when you attach a real domain to it it still uses the old one as the real repo ). So when I pulled one of Heroku's default names like smooth-buttery-back-52.git , it pulled and worked, and was actually my repository.
刚刚发现 git repo 实际上是空的。它只是一个符号链接(当您将一个真正的域附加到它时,它仍然使用旧的作为真正的 repo )。因此,当我拉取 Heroku 的默认名称之一(如 smooth-buttery-back-52.git )时,它拉取并工作,实际上是我的存储库。
采纳答案by prodigitalson
>> sudo ssh-keygen
NO. Drop the sudo. That will create keys for the root user, not your user. Well unless of course for some strange reason you want to use root. But then you need to prefix all related commands that are going to use this key with sudo
.
不。放下sudo。这将为 root 用户创建密钥,而不是您的用户。好吧,当然除非出于某种奇怪的原因您想使用 root。但是,您需要在将要使用此键的所有相关命令前加上sudo
.
回答by Tabrez
I followed the steps provided by heroku and it worked. Once you have generated ssh keys (it does not matter what you call the files), just do the following:
我按照 heroku 提供的步骤操作,它奏效了。一旦你生成了 ssh 密钥(不管你叫什么文件),只需执行以下操作:
> heroku login
> heroku keys:add
The first statement prompts you for your heroku userid/password. Once you are authenticated, running the second command picks all your public keys and pushes it out to heroku.com. After that you can run git clone and it will work like a charm!
第一条语句提示您输入您的 heroku 用户 ID/密码。一旦您通过身份验证,运行第二个命令会选择您的所有公钥并将其推送到 heroku.com。之后你可以运行 git clone ,它会像魅力一样工作!
回答by Hardik Hardiya
If you already done
如果你已经完成了
heroku keys:add
and still getting error, then please try
仍然出现错误,然后请尝试
ssh-add
回答by Ng? V?n Thao
https://devcenter.heroku.com/articles/keys#adding_keys_to_herokuIt worked with me :
https://devcenter.heroku.com/articles/keys#adding_keys_to_heroku它对我有用:
$ heroku keys:add
$ heroku 键:添加
回答by angelokh
this is a plugin for heroku to manage your account. https://github.com/ddollar/heroku-accounts
这是 heroku 管理您帐户的插件。 https://github.com/ddollar/heroku-accounts
回答by Jed Schneider
you made a key for your sudo account, but not for your user account and you didn't sudo heroku keys:add
so it uploaded the local user key not the sudo key, i'm guessing. Why would you want your local app in your home directory to have sudo permissions anyway? I would probably x the sudo and just do it as your user following this tutorial: http://docs.heroku.com/keys
您为您的 sudo 帐户创建了一个密钥,但没有为您的用户帐户创建一个密钥,而您没有sudo heroku keys:add
这样做,因此它上传了本地用户密钥而不是 sudo 密钥,我猜。无论如何,您为什么希望主目录中的本地应用程序具有 sudo 权限?我可能会 x sudo 并按照本教程作为您的用户执行此操作:http: //docs.heroku.com/keys