search

Home  >  Q&A  >  body text

git - How to completely delete a branch/master push fails

Push masterThe following error occurred when branching:

To git@gitlab.ddcard.com.cn:csntgao/qiaruqifen.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@gitlab.ddcard.com.cn:csntgao/qiaruqifen.git'

masterThe branch can only be pulled but not pushed. Other branches are normal. I searched online and said that I need to delete the two files in .git. I did it but failed

I remember that I might have deleted something by mistake when I rolled back the version on the master, so I planned to delete the local master branch and pull a new master branch again. I used fetch and then checkout master Then I made some modifications and tried push, but the same error occurred in the Korean version

I think it may be necessary to completely delete the branch deleted by git branch -D. Master, please come soon

ringa_leeringa_lee2786 days ago576

reply all(2)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-02 09:37:52

    Look at the article I wrote, how to use github and common mistakes

    reply
    0
  • 迷茫

    迷茫2017-05-02 09:37:52

    You may consider rolling back the local master to the same version as the online one

    git reset --hard ooxxooxx

    ooxxooxx represents the version number seen using git log. It’s a long string
    and then

    git pull

    Go on and finish the work, commit and push
    If you can’t push, it basically means that your account does not have push permission to the remote master

    reply
    0
  • Cancelreply