【发布时间】:2013-02-09 21:30:48
【问题描述】:
我正在关注Dan Eden's Github workflow guide。我在尝试使用git push -u origin master 将我的更改从远程推送到 Github 时遇到了问题。我已将所有文件添加到阶段并提交,当我使用上面的命令时,它会返回:
To git@github.com:tomoakley/5-lines.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:tomoakley/5-lines.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
所以我尝试使用git pull,正如它所建议的那样,它会返回:
git: 'pull' is not a git command. See 'git --help'.
Did you mean this?
shell
我已经联系了我的两个网络主机,他们说这不是 Git 安装的问题,而是我的 ssh 密钥的问题(使用ssh -T git@github.com 返回正常的经过身份验证的消息),所以它不可能那。我还联系了 Github,目前正在调查中。 Github 支持人员告诉我使用我现在正在做的SSH agent forwarding。
关于我的服务器和 git 的一些细节:
-
git --version: git 版本 1.7.12 -
git --exec-path: /usr/local/libexec/git-core
感谢任何回答的人:)
【问题讨论】:
-
通常在初始推送时您可能想要
git push -f -u origin master -
@three 太棒了,这适用于推送!尽管如此,仍然没有修复拉力。谢谢您的帮助! :)
-
@three 他在推送时收到的错误消息表明这不是他最初的推送,如果远程分支在他之前,他当然不应该强迫它。
-
@adamdunson 我已经从我的本地机器上进行了几次推送,以预先使用 .txt 文件和其他东西进行测试,但没有什么大不了的。我之前已经再次删除了它们,所以当我进行推送时,repo 是空的。
标签: git version-control github git-push git-pull