Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Problems with denycurrentbranch setting when pushing commits to origin

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?

1 answer

were you able to resolve this?

Are you able to push into dev and pull into the local?  

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

7,146 views 5 13
Read article

Community Events

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

Events near you