github问题 - 错误:无法推送一些引用

时间:2013-07-19 08:34:33

标签: git git-push git-pull

我正在尝试将我的主分支推送到我的生产分支。

通常当我在我的Ubuntu计算机上进行更改时,我会按照以下方式进行更改:

git add .
git commit -m "message"
git push

一切正常。然后我就这么做:

git push origin master:production

一切正常。但是现在由于某种原因,当我在终端I中执行'git push origin master:production'时会收到消息:

To git@github.com:Username1/myapp.git
 ! [rejected]        master -> production (non-fast-forward)
error: failed to push some refs to 'git@github.com:Username1/myapp.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.
mypc@ubuntu:~/myapp$ 

我如何解决这个神秘兴起的烦人问题?我尝试了'git pull origin master',正如消息中和我研究中的其他地方所建议的那样,但我在Terminal中获得的是“一切都是最新的”,当我再次尝试时,问题再次发生。感谢。

3 个答案:

答案 0 :(得分:2)

有人已经致力于生产部门。

正如@ user1281385所说,你应该

在以其他方式审核生产分支的更改之前,

git pull origin master:prooduction或更好。

尝试git help pull阅读更多内容。

答案 1 :(得分:1)

远程更改在存储库上完成。正如错误消息所示:

Merge the remote changes (e.g. 'git pull') before pushing again.

先拉,然后推。

答案 2 :(得分:1)

如果您在此次推送与最后一次推送之间进行了重置,则可以尝试git push origin --force master:production

相关问题