git - Push to remote server and Github -
summary: want edit files locally, push both github , web server.
i have 2 remotes set without issue, right sort of able this; however, have have branch checked out locally, , branch b on server. have ssh server , check out branch (the 1 want). don't want or need second branch, many posts suggest can't or shouldn't push non-bare repository. there must better way. using rsync easier (and did while).
strangely, never happens on github. repos have 1 branch , i've never gotten warning.
the warning message says can set receive.denycurrentbranch
ignore, don't know how safe/sane is. i'm hoping understand vague description (which due limited knowledge of git) , know optimum solution.
it easier set-up post-receive hook on bare repo on web server.
way, hook can:
- change directory , pull new changes actual non-bare repo
- checkout branch want
see "git post-receive hook website staging" , work in "using git manage web site":
$ 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
(note: fun fact, can push 2 different remote repos simultaneously)
Comments
Post a Comment