所以我最近尝试在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.
对不起什么?!你最新的?好的,推着该死的东西......
现在我的公司不允许非快速推送,我无法得到这个回购的管理员 - 任何想法?
答案 0 :(得分:2)
您不能git push
,因为根据您的计算机,远程分支与应有的分支不同。可能还有其他人推了一些代码。要解决此问题,您需要先git pull
,然后再git push
。