简体   繁体   English

git clone heroku ssh权限被拒绝

[英]git clone heroku ssh permission denied

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 git@heroku.com: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? 有任何想法吗?

UPDATE I went into my ~/.ssh file and performed ssh-keygen -t rsa and i made a new key called love . 更新我进入我的〜/ .ssh文件并执行了ssh-keygen -t rsa ,我创建了一个名为love的新密钥。 Then I heroku keys:add love.pub successfully. 然后我heroku keys:add love.pub成功heroku keys:add love.pub

Then I went to git clone.. 然后我去了git clone ..

sudo git clone -o heroku git@heroku.com: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 . 我删除了〜/ .ssh,并在没有sudo情况下重新创建了它。 Then I removed all my keys I had created today off of heroku , and restarted the process. 然后我删除了今天从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== macuser@Mac-Users-MacBook-Pro.local

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 git@heroku.com:shwagr.git heroku键:清除rm -rf~ / .ssh mkdir~ / .ssh cd~ / .ssh ssh-keygen -t rsa heroku keys:添加cd / Users / macuser / Sites / sudo git clone -o heroku git@heroku.com :shwagr.git

Failed. 失败。

fatal: The remote end hung up unexpectedly 致命:远程端意外挂断

Huge Update 巨大的更新

Just found out that git repo is actually empty. 刚刚发现git repo实际上是空的。 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. 因此,当我拉出Heroku的默认名称之一,如smooth-buttery-back-52.git时,它拉动并工作,实际上是我的存储库。

I followed the steps provided by heroku and it worked. 我按照heroku提供的步骤进行操作。 Once you have generated ssh keys (it does not matter what you call the files), just do the following: 生成ssh密钥后(无论您调用的是什么文件),只需执行以下操作:

> heroku login
> heroku keys:add

The first statement prompts you for your heroku userid/password. 第一个语句提示您输入heroku用户ID /密码。 Once you are authenticated, running the second command picks all your public keys and pushes it out to heroku.com. 通过身份验证后,运行第二个命令会选择所有公钥并将其推送到heroku.com。 After that you can run git clone and it will work like a charm! 之后,您可以运行git clone,它将像魅力一样工作!

>> sudo ssh-keygen

NO. 没有。 Drop the sudo. 放弃sudo。 That will create keys for the root user, not your user. 这将为root用户而不是您的用户创建密钥。 Well unless of course for some strange reason you want to use root. 好吧,除非出于一些奇怪的原因你想要使用root。 But then you need to prefix all related commands that are going to use this key with sudo . 但是,您需要为将要使用此密钥的所有相关命令添加前缀sudo

If you already done 如果你已经完成了

heroku keys:add

and still getting error, then please try 仍然会出错,请尝试

ssh-add

this is a plugin for heroku to manage your account. 这是heroku管理您帐户的插件。 https://github.com/ddollar/heroku-accounts https://github.com/ddollar/heroku-accounts

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. 你为你的sudo帐户创建了一个密钥,但没有为你的用户帐户创建sudo heroku keys:add而你没有sudo heroku keys:add所以它上传了本地用户密钥而不是sudo密钥,我猜。 Why would you want your local app in your home directory to have sudo permissions anyway? 为什么您希望主目录中的本地应用程序具有sudo权限? I would probably x the sudo and just do it as your user following this tutorial: http://docs.heroku.com/keys 我可能会尝试使用sudo,并按照本教程的说明进行操作: http//docs.heroku.com/keys

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM