2012-12-28 41 views
0

因此,我今天在终端上打开了我的rails项目,并做了一些更改并尝试推送到github,但它不起作用。我搜索谷歌和堆栈溢出,所有人都指向安装github解决我的问题的说明。Git推送给予权限被拒绝(publickey)。致命的:远端意外挂断。我该怎么办?

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

[email protected]:~/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") 

[email protected]:~/Desktop/sample_app$ git add . 
[email protected]:~/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(-) 
[email protected]:~/Desktop/sample_app$ git push 
Permission denied (publickey). 
fatal: The remote end hung up unexpectedly 

[email protected]:~/Desktop/sample_app$ ssh-add -l 
The agent has no identities. 

[email protected]:~/Desktop/sample_app$ git credential-osxkeychain 
Usage: git credential-osxkeychain <get|store|erase> 

此外,为什么说#你的分支在3次提交之前超过了'origin/filling-in-layout'?

回答

3

我建议,这说明理由

[email protected]:~/Desktop/sample_app$ ssh-add -l 
The agent has no identities. 

您需要添加您的重点用 到ssh-agent SSH-添加/路径密钥文件

你会被要求输入你的密码,如果你有一个,然后钥匙将被添加到你的钥匙串。然后你应该能够推动提交。

它说“#你的分支在3次提交中位于'origin/filling-in-layout'之前”的原因是因为你尚未推送提交。您的本地版本是3远程版本提交。一个你成功地完成了推动,情况并非如此。

+0

谢谢尼克!我如何执行这部分建议? “ssh-add/keyfile的路径” –

+0

@PavanKatepalli你有没有把东西推到github之前?如果是这样,你应该设置一个你使用的ssh密钥。例如,我的文件位于'.ssh/github'文件中。所以在命令行我输入'ssh-add〜/ .ssh/github /'。如果你还没有这样做,你将需要 - [本文](https://help.github.com/articles/generating-ssh-keys)应该有所帮助 –

+0

嘿尼克我有以前,我有一个SSH密钥。我把你写的东西复制到命令行中,它给了我一个“没有文件或目录” –

相关问题