1

I want to use my local machine for development and use a remote server for staging. I first set up a git repo on my remote server and committed the files, then I cloned that repo locally.

That worked fine, but when I try to push changes to the remote:

git push origin master

I get the following error:

remote: error: refusing to update checked out branch: refs/heads/master
By default, updating the current branch in a non-bare repository is denied, because it will make the index and work tree inconsistent with what you pushed, and will require 'git reset --hard' to match the work tree to HEAD.

You can set 'receive.denyCurrentBranch' configuration variable to 'ignore' or 'warn' in the remote repository to allow pushing into its current branch; however, this is not recommended unless you arranged to update its work tree to match what you pushed in some other way.

To squelch this message and still keep the default behaviour, set 'receive.denyCurrentBranch' configuration variable to 'refuse'.

Community
  • 1
  • 1
Mark Salvatore
  • 628
  • 1
  • 7
  • 13
  • already answered here: http://stackoverflow.com/questions/2816369/git-push-error-remote-rejected-master-master-branch-is-currently-checked?rq=1 – Lesstat Nov 13 '12 at 13:05
  • 2
    I'm looking to push files to a web server, so the files need to be present in the web directory. I found a number of solutions for this, but none is as simple and well -explained as Joe Maller's post from almost 6 years ago. http://joemaller.com/990/a-web-focused-git-workflow/ – Mark Salvatore Nov 14 '12 at 00:36

0 Answers0