git push rejected:错误:未能推送一些裁判 [英] git push rejected: error: failed to push some refs
问题描述
git reset --hard 41651df8fc9
code>
我做了一些改变,我做了一些提交,现在我试图将所有这些提交服务器出现以下错误:
! [被拒绝] master - > master(非快速转发)
错误:未能将某些文件推送到'git@git.somewhere.git'
Git建议进行git pull,这是其他人向其他用户建议的。但是,我相信git pull会将我当前的代码与我不想再使用的代码合并(head revision)。
我该如何进行推送,忘记我之前的版本/修订版本?
git push -f
如果你有权限的话,但是这会让其他从这个回购中拉出来的人搞砸,所以要小心。
如果这被拒绝,并且你有权访问服务器,就像canzar在下面说的那样,你可以在服务器上用
git config receive.denyNonFastForwards false
I know people have asked similar questions, but I believe the causes of their problems to be different. I did a hard reset because I had messed up my code pretty bad
git reset --hard 41651df8fc9
I've made quite some changes, I've made some commits and now that I'm trying to push all these commits into the server I get the following error:
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@git.somewhere.git'
Git suggests to do a git pull and that's what other people have suggested to other users. However, I believe that a git pull will merge my current code with the code that I don't want anymore (head revision). How can I do a push and forget about the version/revisions ahead of me?
git push -f
if you have permission, but that will screw up anyone else who pulls from that repo, so be careful.
If that is denied, and you have access to the server, as canzar says below, you can allow this on the server with
git config receive.denyNonFastForwards false
这篇关于git push rejected:错误:未能推送一些裁判的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!