0

I've got a git workspace on my remote linux VM(e.g 100.79.180.80) under /user/repo1.

I wish to keep different code changes and finally commit the one I'm most satisfied, so I tried to use my ubuntu desktop to clone from this linux VM(not the final remote repo). So I "git clone" from the linux VM to a local directory. OK.

But if I change some files locally and 'add/commit/push', git will reject it, saying:

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

Is there anyway to work around this? I just with to have 2 jumps of my git, one jump to keep my local changes and push the best one to remote working workspace, and from this workspace push to real remote repo.

How to achieve it? Thanks.

Hind Forsum
  • 9,717
  • 13
  • 63
  • 119
  • You can, but I don't advise it. Is there a reason you aren't creating a bare repo on the same machine? That way you don't get your working-tree state out-of-sync. – Charles Duffy May 31 '17 at 03:11
  • ...as for the "you can", see the error message from the linked duplicate of the question, which describes how to disable the error (as well as why you shouldn't). – Charles Duffy May 31 '17 at 03:13

0 Answers0