Click on remote server and github

Summary: I want to edit files locally, and then click on Github and on my web server.

I have two remotes configured without problems, so now I'm kind of able to do this; however, I must have branch A extracted locally and branch B on the server. Then I have to use SSH on the server and check the A branch (the one I want). I really don’t even need or need a second branch, but many posts suggest that you cannot or should not click on a non-bare repository. There must be a better way. Even just using rsync would be easier than that (and I did this for a while).

Strange, this never happens on Gituba. Almost all my repositories have only one branch, and I never received this warning.

The warning message says you can set receive.denyCurrentBranchto ignore, but I don't know how safe this is. I hope someone understands my vague description (which is related to my limited knowledge of git) and find out the best solution.

+5
source share
1 answer

It would be easier to set up a post-receive hook on a bare repo on your web server.
Thus, this hook can:

  • change directory and pull new changes to actual non-naked repo
  • select the desired branch

See “ Git Post-Accept Hook for a Website ” and the work in Using Git to Manage a Website :

$ 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

(: , )

+4

All Articles