git push heroku master 权限在 VISTA 上被拒绝

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1824759/
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-19 03:58:14  来源:igfitidea点击:

git push heroku master permission denied on VISTA

gitsshgithubherokupublic-key

提问by KT.

(Using Vista)I'm trying to clone an app from my GitHub Repository and push it into Heroku. Okay, so I've tried to create an SSH key so many times with this:

(使用 Vista)我正在尝试从我的 GitHub 存储库克隆一个应用程序并将其推送到 Heroku。好的,所以我多次尝试使用此创建 SSH 密钥:

 `ssh-keygen -t rsa` 

It seems to go perfectly. I have it on my C:/Users/***/.ssh folder. I now try to clone an app i forked in GitHub. When I try to clone it on the rails_apps directory, I get a message saying

它似乎完美无缺。我把它放在我的 C:/Users/***/.ssh 文件夹中。我现在尝试克隆我在 GitHub 中分叉的应用程序。当我尝试在 rails_apps 目录中克隆它时,我收到一条消息说

 Permission Denied(public key). 

I found a solution on the net saying that I should run this first:

我在网上找到了一个解决方案,说我应该先运行它:

`ssh-add` 

So I tried doing that. But it said that:

所以我尝试这样做。但它说:

Could not open a connection to your authentication agent.

无法打开与您的身份验证代理的连接。

Then after some googling I find something about executing the ssh-agent. So I do this:

然后经过一些谷歌搜索,我找到了一些关于执行 ssh-agent 的信息。所以我这样做:

`ssh-agent bash`

and the command line changes from my rails_apps directory to this:

命令行从我的 rails_apps 目录更改为:

`bash3.1$>`

So I run:

所以我运行:

`bash3.1$>ssh-add [path to .ssh folder]`

and it successfully adds the rsa private key(it doesn't work with id-rsa.pub). I have also pasted the newly generated public key to my GitHub account.

并且它成功添加了 rsa 私钥(它不适用于 id-rsa.pub)。我还将新生成的公钥粘贴到我的 GitHub 帐户中。

Now when I try to clone:

现在,当我尝试克隆时:

`bash3.1$>git clone [email protected]:username/myrepo.git`

It now successfully clones the repo I forked in GitHub. Now that I have the app in my local repo, I try to create a heroku app.

它现在成功克隆了我在 GitHub 中分叉的 repo。现在我的本地存储库中有该应用程序,我尝试创建一个 heroku 应用程序。

`bash3.1$>cd myrepo`  
`bash3.1$>heroku create myapp`

And this code runs successfully. Git remote added successfully. Now all I have to do is to push it.

并且此代码运行成功。Git 远程添加成功。现在我要做的就是推动它。

`bash3.1$>git push heroku master`

BAM! I get the error message again.

砰!我再次收到错误消息。

Permission denied (public key)

Permission denied (public key)

I am so close into pushing my app to heroku. But it just won't work. Can you help me. What am I doing wrong here? Thanks! :D

我非常接近将我的应用程序推送到 heroku。但这根本行不通。你能帮助我吗。我在这里做错了什么?谢谢!:D

采纳答案by VonC

Note: your ticket on GitHub Supportprompted the answer:

注意:您在 GitHub 支持上的工单提示了答案:

You need to give heroku your key. There should be a command to do it. If you can't find it, you'll have to contact their support.

你需要给heroku你的钥匙。应该有一个命令来做到这一点。如果找不到,则必须联系他们的支持人员。

For that, see Graeme Collins's answer(and also Heroku error: "Permission denied (public key)"):

为此,请参阅Graeme Collins回答(以及Heroku 错误:“Permission denied (public key)”):

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

See Heroku devcenterfor more on that process.
You can then see a list of all keys, including the key's name, like this:

有关该过程的更多信息,请参阅Heroku 开发中心
然后您可以看到所有键的列表,包括键的名称,如下所示:

heroku keys

Note: that suppose you didn't use sudo to generate your keys, as " git clone heroku ssh permission denied" illustrates (where heroku keys:adddoesn't work)

注意:假设您没有使用 sudo 来生成您的密钥,因为“ git clone heroku ssh permission denied”说明了(哪里heroku keys:add不起作用)



More information about your ssh keys in your other GitHub Support ticket.

有关您的其他GitHub 支持票中的ssh 密钥的更多信息。

debug1: Trying private key: /.ssh/identity
debug1: Trying private key: /.ssh/id_rsa
debug1: Trying private key: /.ssh/id_dsa

I'm not sure why it would be looking at /.sshand not ~/.sshthen.
Try moving your keypair over to that path.

我不确定为什么它会查看/.ssh而不是~/.ssh然后。
尝试将您的密钥对移动到该路径。



Shouldn't that be:

不应该是:

 git push origin master

? By default, a reference to the cloned repo is called 'origin', not 'heroku'

? 默认情况下,对克隆 repo 的引用称为“origin”,而不是“heroku”

What does

有什么作用

git remote -v show

display?

展示?

It you want, you can reference the distant repo by the heroku name

如果你想要,你可以通过 heroku 名称引用远程仓库

git remote add heroku [email protected]:git_username/projectname.git

回答by Graeme Collins

I had a similar problem. Running the following command fixed it for me:

我有一个类似的问题。运行以下命令为我修复了它:

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

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

Substitute "~/.ssh/id_rsa.pub" with your path to your id_rsa.pub file.

将“~/.ssh/id_rsa.pub”替换为 id_rsa.pub 文件的路径。

回答by Mingming

The following line solved the problem for me.

以下行为我解决了这个问题。

heroku accounts:set youraccount

回答by FMQB

You can login first in heroku providing Enail and Password and can follow the following steps to add a local git repository into a heroku application instance.

您可以先在 heroku 中提供 Enail 和 Password 登录,然后可以按照以下步骤将本地 git 存储库添加到 heroku 应用程序实例中。

  1. Issue this command at the Git Bash $ ssh-keygen -t rsa (default location and with empty passphrase. You can alternatives too).
  2. Again issue at the bash $ heroku keys:add (It will automatically add the public key from the default location).
  3. Issu this at the bash to check keys. $ heroku keys .
  4. You can add the remote for you app name $ heroku git:remote -a app_name
  5. Now you can push the git repo to the heroku using this command $ heroku push origin master
  1. 在 Git Bash $ ssh-keygen -t rsa 发出这个命令(默认位置和空密码。你也可以替代)。
  2. 再次在 bash $ heroku keys:add 发出问题(它会自动从默认位置添加公钥)。
  3. 在 bash 上发出这个来检查密钥。$ heroku 键。
  4. 您可以为您的应用程序名称添加遥控​​器 $ heroku git:remote -a app_name
  5. 现在你可以使用这个命令将 git repo 推送到 heroku $ heroku push origin master