Managing website using git + post-receive hook: error pushing changes -
question: how push local commits development server if worktree not bare?
my situation:
- i set git on development server when push local changes, added detached working tree (as described here , this post).
- i experienced problems running git on dev server (eg,
git status) because git not find working tree. - i asked around , got tip off needed set
bare = falsein config file , specify worktree. sweet.
but when try push commits dev server error:
$ git push origin master xxxx@xxx.xxx.xxx.xxx's password: counting objects: 26, done. delta compression using 4 threads. compressing objects: 100% (18/18), done. writing objects: 100% (18/18), 2.56 kib, done. total 18 (delta 8), reused 0 (delta 0) remote: error: refusing update checked out branch: refs/heads/master remote: error: default, updating current branch in non-bare repository remote: error: denied, because make index , work tree inconsistent remote: error: pushed, , require 'git reset --hard' match remote: error: work tree head. remote: error: remote: error: can set 'receive.denycurrentbranch' configuration variable remote: error: 'ignore' or 'warn' in remote repository allow pushing remote: error: current branch; however, not recommended unless remote: error: arranged update work tree match pushed in remote: error: other way. remote: error: remote: error: squelch message , still keep default behaviour, set remote: error: 'receive.denycurrentbranch' configuration variable 'refuse'. ssh://xxxx@xxx.xxx.xxx.xxx/xxx/xxx/xxxxxx.git ! [remote rejected] master -> master (branch checked out) error: failed push refs 'ssh://xxxx@xxx.xxx.xxx.xxx/xxx/xxx/xxxxxx.git' i see this other user had same problem. unfortunately, solution worked him setting bare = true in config, recreate problem having in step 3 above.
the error message says
you can set 'receive.denycurrentbranch' configuration variable remote: error: 'ignore' or 'warn'
in case, ok me this? sounds me, i'm not familiar enough git yet recognize bad idea when comes around...
edit
just clear, have added post-receive hook , it's working smoothly. problem seem have choose between bare=true (and being able push dev server) , bare=false (and being able run git commands on dev server).
why not:
- pushing commits bare repo
- setting post-receive hook on dev repo go non-bare dev repo , checkout right branch, pulling new commits bare repo?
that your link describes (with detached working tree), sets hook in bare repo:
$ mkdir /var/www/www.example.org $ cat > hooks/post-receive #!/bin/sh git_work_tree=/var/www/www.example.org git checkout -f $ chmod +x hooks/post-receive
Comments
Post a Comment