git push rejected:错误:未能推送一些裁判 [英] git push rejected: error: failed to push some refs

查看:126
本文介绍了git push rejected:错误:未能推送一些裁判的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有人问过类似的问题,但我相信他们的问题的原因是不同的。我做了一个硬复位,因为我弄糟了我的代码很糟糕

  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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆