I used this link to setup git bare repo and try to have the files in web server. I wrote this line in hooks/post-receive
file to update files in web server
GIT_WORK_TREE=/var/www/www.example.org git checkout -f
After I push the code to bare repo, I don't see files in var/www/www.example.org
what would be the problem?
update: my files are in staging
branch not in master
. so should I do use staging
in checkout
You should create directory before.
mkdir /var/www/www.example.org
And makesure git
user have accress to this dir.
sudo chown git. /var/www/www.example.org
sudo -u git -H chmod 755 /var/www/www.example.org
Make sure the post-receive
hook is actually being executed. You can add a echo
command if you want.
The #!/bin/sh
is necessary in many cases and also make sure you have marked the hook as executable.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.