Git - Unable to push to non-bare repo after install receive.denycurrentbranch = ignore

My setup looks like this:

I am running git version 2.3.2 (Apple Git -55) on my mac. It has a non-bare git repository sitting at ~/xyz

.

Then I run Windows 7 64bit using VMWare Fusion on the same Mac. The VM has git 1.9.5, which is the latest version of git for Windows. From VM, I can clone and pull from my mac non-bare repo ~/xyz

OK, but I cannot push to it. I followed the suggestion here and set receive.denycurrentbranch=ignore

to ~/xyz

, but it still gives the same error message:

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:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.

      

I also tried to install receive.denycurrentbranch=updateInstead

, but still the same error message.

I rebooted my computer after each instance by changing my git settings.

The directory ~/xyz

is the shared directory for my virtual machine and I have ensured that the virtual machine has read / write access.

Please, have any ideas?

+3


source to share


2 answers


You need to run the command from the server you are pushing the code to not from the local repo system



git config --global receive.denyCurrentBranch ignore

      

+4


source


First, the VM can use whatever version of Git it wants, not just the old and outdated msysgit 1.9.5 one: git for windows offers the latest 2.4.6 .
No installation required, just unzip PortableGit-2.4.6-5th-release-candidate-64-bit.7z.exe anywhere and add your bin folder to %PATH%

.

I also tried setting get.denycurrentbranch = updateInstead

This git 2.3.0+ feature (see release notes ) needs to be installed on the server side, not on the client.



If not convenient, OP Jason L mentions a workaround in the comments :

do not push to mac Git repo from VM, but pull VM Git repository from mac instead.

+1


source







All Articles