git commint / push error

Running a project that is actively programmed without version control nowadays is complete madness. In general, there are many bazaar options , mercurial , git , svn . So here if you expect me to explain which version control is better and why it won't be. We use git. There are many reasons – easy to set up, it is very flexible, was written by Linus Torvalds to serve Linux Kernel versions, the latter are at least 2 reasons 😉 . Today I had to create a new repository, that a new project has started. I actually created a few repositories a long time ago when we needed them and I forgot the thin moments about it. I create the repository I crashed a few files for the first storage everything went exactly. The storage setup itself was standard:

git init
echo "Short project's description" > .git/description
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
git commit -a
touch .git/git-daemon-export-ok

In general, nothing is wrong. Then I decided to test from a remote machine to store content and when I tried to push it, it exploded with the ugly message:

Pushing to git://gitHost/project
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’.
To git://gitHost/project
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to ‘git://gitHost/project’

So obviously I'm trying to commit to the main tree of the project and the software politely cuts me. In general, I have no intention of doing an additional brunch because the people involved in the projects are clear and a number of other reasons.. Here comes the moment to note that I have defined the title very incompetently, but this is another point. In general, the solution to the problem is trivial. In .git / config of your project you need to add the following directive:

[receive]
denyCurrentBranch = false

Then everything falls into place.

http://www.youtube.com/watch?v = 16bRiH5zfOY

Leave a Reply

Your email address will not be published. Required fields are marked *

Anti SPAM *