1

所以我最近尝试在 git 中执行以下操作:

Username for '##### - Site': User
Password for '##### - Site':
To https://comtech.git.beanstalkapp.com/ong-sis.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to '##### - Site'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and merge the remote changes
hint: (e.g. 'git pull') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

所以我想,好吧-让我们尝试强制执行-我知道但请继续阅读-我对此的推理是因为我尝试推送的分支的主人也有我不再关心的代码-我是唯一的推动这个回购的人。

所以我尝试了这个:

$ git push --force SISONG master
Username for '##### - Site': user
Password for '##### - Site':
Counting objects: 190, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (110/110), done.
Writing objects: 100% (111/111), 599.75 KiB | 0 bytes/s, done.
Total 111 (delta 60), reused 40 (delta 1)
remote: error: denying non-fast-forward refs/heads/master (you should pull first
)
To https://comtech.git.beanstalkapp.com/ong-sis.git
 ! [remote rejected] master -> master (non-fast-forward)
error: failed to push some refs to '##### - Site'

所以最后我决定,你知道什么 - 让我们拉 - 让我们做它并处理合并问题。

$ git pull SISONG master
Username for '##### - Site': user
Password for '##### - Site':
From ##### - Site
 * branch            master     -> FETCH_HEAD
Already up-to-date.

对不起什么?!所以你是最新的?好吧,推那该死的东西....

现在我的公司不允许非快进推送,而且我无法获得这个 repo 的管理员 - 有什么想法吗?

4

1 回答 1

2

你不能git push,因为远程分支已经偏离了你的计算机应该是什么。可能其他人也推送了一些代码。为了解决它,您需要git pull先解决,然后git push再解决。

于 2013-09-03T18:57:59.353 回答