Git不推

时间:2015-05-06 18:59:15

标签: git github

所以我有一个项目结账,主分支指向一个回购,而网站开发分支指向另一个回购。

网站开发分支指向具有远程站点名称的仓库。

当我做git pull site master时,我看到了:

$ git pull site master
From github.com:AdamKyle/freya-framework-site
 * branch            master     -> FETCH_HEAD
Already up-to-date.

所以当我做git push site master时,我得到了:

$ git pull site master
From github.com:AdamKyle/freya-framework-site
 * branch            master     -> FETCH_HEAD
Already up-to-date.
vagrant@vagrantpress:/vagrant/wordpress/wp-content/themes/freya-theme$ git push site master 
To git@github.com:AdamKyle/freya-framework-site.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:AdamKyle/freya-framework-site.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

此分支和主分支都是最新的。发生了什么事?

2 个答案:

答案 0 :(得分:2)

我相信你的本地主副本是在#34; site"的主人身后。

我做了两个回购演示:

$ git status
On branch asdf
nothing to commit, working directory clean

$ git pull site master
From file:///tmp/site
 * branch            master     -> FETCH_HEAD
Already up-to-date.

$ git push site master
To file:///tmp/site
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'file:///tmp/site'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
$

本地" asdf"是最新的"网站"大师,但我当地的主人不是。

推动当地"主人"到"网站"失败,因为远程主人在前面。

答案 1 :(得分:-1)

使用--force标志。

git push site master --force