I want to store my local modifications to JBoss config in git. For this, I have set up the following structure:
lrwxrwxrwx 1 jboss jboss 19 Jan 24 11
Pushing is meant for bare repos. For non-bare repos you should pull into them.
If you want to force this through anyway, you can do as the error message states and set receive.denyCurrentBranch to ignore. SSH to the location of the repo you are pushing to and run:
git config receive.denyCurrentBranch ignore
I know this is quite an old question, but if you go with git init --bare, watch out for 'GIT_DIR=.' which will be set for a bare repo hook if using hooks to checkout the repo after pushing. Use 'export GIT_DIR=.git' in your hook routine to make it recognise the repo you are pulling into....
Create the origin (local) repository as a bare repository (ie. git init --bare), or checkout a branch in there which is not master.
I managed to get round this by pulling from 'local' in 'current' rather than pushing to 'current' from 'local'.
The master branch at remote site is checked out. If you have access to remote repository, checkout any other branch and then push from your repository.
OR,
when you initialize your remote project, using
git init --bare