I set up a Git repository for a development site I'm working on. It's a non-bare repository, since it's the actual development site, so the files need to be there. But I'm running into problems when trying to push changes from my local computer to the dev site.
Initially I was getting the error message "fatal: bad config value for 'receive.denycurrentbranch' in ./config". After checking its value (it was set to "updateInstead"), and doing some searching online and reading various articles, forum posts, etc., it looked like some versions of Git don't support that value, and if that's the case then you need to set it to "refuse" or "ignore".
I updated Git on my local computer and made sure SourceTree was using the most recent version available for Mac OS X (2.27.0), but I still got the same error.
So I tried both the other settings I'd seen recommended, but refuse just gave me a different error instead ("error: refusing to update checked out branch: refs/heads/master"). Ignore appeared to work, in that it didn't generate any error messages, but then I found that it hadn't actually pushed any changes, just failed silently. So it looks like updateInstead IS the only setting that would allow actually pushing changes, but for some reason SourceTree (and command-line Git also) keep telling me that's invalid.
I did a little more reading to try and get a better understanding of what was happening, and apparently Git doesn't like to push changes to a non-bare repository if it's to the current branch? But this is a fairly simple respository, on which I'm the only developer, so there only IS one branch. I tried to get a better understanding of what "checked out" meant with regard to the master branch, but as far as I've been able to determine (I am not a Git expert by any means), it just means that's the current active branch?
Obviously I'm doing something wrong, but I'm not sure what. I just want to be able to push changes from my local computer, but also to be able to work directly on the dev site sometimes, and then commit the changes there and pull them to my local. Is there a better way I can make that happen?
Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events