0

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

因此,我浏览了所有说明,但仍然遇到同样的问题。请帮忙!

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>

另外为什么它说#你的分支在 'origin/filling-in-layout' 之前 3 次提交?

4

1 回答 1

3

我建议这说明原因

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

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

如果您有密码,系统会要求您输入密码,然后将密钥添加到您的钥匙串中。然后,您应该能够推动提交。

它说“# Your branch are ahead of 'origin/filling-in-layout' by 3 commits”的原因是因为你还没有推送你的提交。您的本地版本比远程版本早 3 次提交。如果您成功完成推送,情况并非如此。

于 2012-12-28T04:28:15.417 回答