Git推送给予权限被拒绝(publickey)。致命的:远端意外挂断。我该怎么办? [英] Git push gives Permission denied (publickey). fatal: The remote end hung up unexpectedly. What should I do?

查看:261
本文介绍了Git推送给予权限被拒绝(publickey)。致命的:远端意外挂断。我该怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我今天在终端上打开了我的rails项目,并做了一些更改并尝试推送到github,但它不起作用。我在谷歌搜索和堆栈溢出,所有人都指出安装github解决我的问题的指示。



所以我经历了所有的指示,我仍然得到相同的问题。请帮助!

  admin @ new-host-2:〜/ Desktop / sample_app $ git status 
#分支填充布局
#您的分支在3次提交之前在原点/填充布局之前。

#没有为commit提交更改:
#(使用git add< file> ...更新将提交的内容)
#(使用git结账 - < file> ...放弃工作目录中的更改)

#修改:app / views / pages / home.html.erb

没有更改添加到提交(使用git add和/或git commit -a)

admin @ new-host-2:〜/ Desktop / sample_app $ git add。
admin @ new-host-2:〜/ Desktop / sample_app $ git commit -am'再次测试git'
[fill-in-layout b607a16]再次测试git
1个文件(+),1删除( - )
admin @ new-host-2:〜/ Desktop / sample_app $ git push
权限被拒绝(publickey)。
致命:远程端意外挂起

admin @ new-host-2:〜/ Desktop / sample_app $ ssh-add -l
代理没有身份。

admin @ new-host-2:〜/ Desktop / sample_app $ git凭证-osxkeychain
用法:git凭证-osxkeychain< get | store | erase>

为什么会这样说#你的分支领先于'origin / filling-in-layout' 3提交?

解决方案

我建议这显示原因

  admin @ new-host-2:〜/ Desktop / sample_app $ ssh-add -l 
代理没有身份。

您需要使用
ssh-add / path将密钥添加到ssh-agent中keyfile

如果您有密钥,系统会要求您输入密码,然后将密钥添加到您的钥匙串中。



它说#你的分支在原点/填充布局之前的原因是3提交了是因为你还没有推动你的提交。您的本地版本是3远程版本提交。你完成推送成功这不会是这种情况。


So I open up my rails project in terminal today and make a few changes and try to push to github, and it doesn't work. I search on Google and stack overflow and all everyone points to the instructions on installing github to fix my issue.

So I went through all the instructions and I still get the same issue. PLEASE HELP!

admin@new-host-2:~/Desktop/sample_app$ git status
# On branch filling-in-layout
# Your branch is ahead of 'origin/filling-in-layout' by 3 commits.
#
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   app/views/pages/home.html.erb
#
no changes added to commit (use "git add" and/or "git commit -a")

admin@new-host-2:~/Desktop/sample_app$ git add .
admin@new-host-2:~/Desktop/sample_app$ git commit -am 'testing git yet again'
[filling-in-layout b607a16] testing git yet again
 1 files changed, 1 insertions(+), 1 deletions(-)
admin@new-host-2:~/Desktop/sample_app$ git push
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

admin@new-host-2:~/Desktop/sample_app$ ssh-add -l
The agent has no identities.

admin@new-host-2:~/Desktop/sample_app$ git credential-osxkeychain
Usage: git credential-osxkeychain <get|store|erase>

Also why does it say # Your branch is ahead of 'origin/filling-in-layout' by 3 commits?

解决方案

I'd suggest that this shows the reason

admin@new-host-2:~/Desktop/sample_app$ ssh-add -l
The agent has no identities.

You need to add your key to ssh-agent using ssh-add /path to keyfile

You'll be asked to enter your passphrase if you have one and then the key will be added to your keychain. You should then be able to push the commits up.

The reason it says "# Your branch is ahead of 'origin/filling-in-layout' by 3 commits" is because you haven't pushed your commits yet. Your local version is 3 commits ahead of the remote version. One you complete the push successfully this won't be the case.

这篇关于Git推送给予权限被拒绝(publickey)。致命的:远端意外挂断。我该怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆