Wireless Army
This is a blog / tips and tricks website for web developers and security researchers.
follow us in feedly


git for web publishing
by admin
 at 2019-07-26 18:21:00.

both version control and files are on the server but the files are for a website and version control is in a directory that people have no access to it

the reason that we separate the git and the project folder is because if we have a php site with password stored, we don't want any one but developers have access to git log so
we use the folder /var/www/gserver for the git and /var/www/webserver for files and for the computer as usual:

git init
git add .
git commit -m "initial commit"
#after setting up the server
git remote add origin ssh://me@mywebsite.com:/var/www/gserver/project1.git
git push origin master

and for the server:

in the /var/www/gserver folder

mkdir project1.git
cd cms.git
git init --bare
touch hooks/post-receive

now past the fallowing lines in the /hooks/post-receive file

#!/bin/sh
GIT_WORK_TREE=/var/www/webserver git checkout -f

and we want it to be executable to work

chmod +x hooks/post-receive

just make sure that apache will use the /var/www/webserver and the main folder for the site