2

I am using SmartGit and I'm trying to push my latest commit to a bare repository, which is definitely bare at /media/webserver/git/projectname, but I keep getting the following output, does anyone have an idea of what is wrong?

Thanks

Push: Not all refs have been pushed.
'master' rejected (non-fast-forward)
Counting objects: 1   
Counting objects: 29, done.
Delta compression using up to 2 threads.
Total 15 (delta 11), reused 0 (delta 0)
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'.        
error: failed to push some refs to '/media/webserver/git/projectname'

And the below shows the output of my earlier attempt to Commit & Push before I tried pulling(rebase) the latest changes, and then doing another push which resulted in the above output.

Commit: Not all refs have been pushed.
[master e465187] * My commit message here
 6 files changed, 580 insertions(+), 325 deletions(-)
 rewrite controllers/courses/views/course_apply.php (98%)
 rewrite controllers/mail/cont_mail.php (96%)
'master' rejected (non-fast-forward)
error: failed to push some refs to '/media/webserver/git/projectname'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Naftali
  • 144,921
  • 39
  • 244
  • 303
lemon
  • 595
  • 1
  • 7
  • 21
  • 2
    possible duplicate of [Git push error '\[remote rejected\] master -> master (branch is currently checked out)'](http://stackoverflow.com/questions/2816369/git-push-error-remote-rejected-master-master-branch-is-currently-checked) – Shahbaz Jul 30 '13 at 16:37

1 Answers1

1

Answering what you won't see immediately in the duplicate

It looks like you want to deploy your website by pushing to repo with a checked-out working copy, which is a bad idea, especially because it gives this kind of error.

You should instead do use a post-update hook and a bare repository, as described here

CharlesB
  • 86,532
  • 28
  • 194
  • 218
  • 1
    Thanks, looks like I had edit the URL of the bare repository to SSH and not to path where the repository is locally mounted. Which may have therefore caused some user permission issues. – lemon Jul 31 '13 at 08:43