Aylık arşivler: Ağustos 2018

git workflow ubuntu www

on ubuntu:

install git

create repo (home git repos)

make .git repo and sub files’ group and owner -> git

in repo hook folder, create “post-receive” and paste this:

git –work-tree=/var/www/[cloned-git-folder] –git-dir=/home/git/repos/[repo-name].git checkout -f

(above work-tree and git-dir commands starts with two – sign)

clone git in var/www

make cloned www folder group -> www-data, owner -> git

connect ssh repo with git user because remote git repo post-receive file’s owner and group is git user

in usr/local/bin create command file like “pull-reponame”

paste this:

cd /var/www/[cloned-repo-folder]
git stash && git pull

you can make owner any user and group git

add execute permission to git group

add any user to git group to allow running this command shortcut