Skip to content

Git bare

Create a folder to deploy to

ssh into your prodctionserver and create folders:

mkdir ~/repos
mkdir ~/actual-code

Add bare repository

cd ~/repos
git init --bare production.git

Add the post-receive hook script

sample post-receive under ~/repos/hooks/ folder

git --work-tree=$FILE_DIR --git dir=$BARE_DIR checkout -f deploy

chmod +x post-receive

Add remote-repository localy

cd ~/path/to/working-copy/
git remote add server ssh://

Push to the production server

git push server main:deploy

Link: Link:

git log -S "search string" --reverse --patch