Git push error '[remote rejected] master -> master (branch is currently checked out)'

前端 未结 30 2211
半阙折子戏
半阙折子戏 2020-11-22 00:07

Yesterday, I posted a question on how to clone a Git repository from one of my machines to another, How can I \'git clone\' from another machine?.

I am now

30条回答
  •  死守一世寂寞
    2020-11-22 00:20

    You have 3 options

    1. Pull and push again:

      git pull; git push
      
    2. Push into different branch:

      git push origin master:foo
      

      and merge it on remote (either by git or pull-request)

      git merge foo
      
    3. Force it (not recommended unless you deliberately changed commits via rebase):

      git push origin master -f
      

      If still refused, disable denyCurrentBranch on remote repository:

      git config receive.denyCurrentBranch ignore
      

提交回复
热议问题