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

前端 未结 30 2715
半阙折子戏
半阙折子戏 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:26

    I just ran into this problem with a deployment git repository on Heroku.

    I don't know why Heroku has a non-bare repository on their side, but as a workaround I was able to reset the remote repository, and reupload.

    You shouldn't use Heroku's copy of your repository as your only git repository for collaboration, but just in case, I'll say clearly: Do not do this unless you are sure you have a full copy of your repository stored securely somewhere other than Heroku. Doing a reset will delete the repository contents.

    To reset:

    1. Install the Heroku toolbelt (which contains the command line client) if you haven't already.
    2. Install the heroku-repo plugin if you haven't already.

      heroku plugins:install https://github.com/heroku/heroku-repo.git
      
    3. Do the reset, which deletes the repository and creates a new, empty one

      heroku repo:reset
      
    4. Push to your Heroku remote as you normally would; it will reupload everything.

提交回复
热议问题