Description of a really basic git deployment strategy.
Simple deployment with git
rous.info
1–4 of 4 posts
Simple deployment with git
rous.info
git init --bare --shared=group /srv/git/app.git
mkdir /var/www/app
chown -R www-data:www-data /srv/git/app.git /var/www/app
chmod -R g+rw /srv/git/app.git /var/www/app
vim /srv/git/app.git/hooks/post-receive
#!/bin/sh
export GIT_WORK_TREE=/var/www/app
git checkout -f dev # dev branch
cd /var/www/app
# Run composer, npm, etc...
chmod +x /srv/git/app.git/hooks/post-receive
Whenever you push it'll checkout the dev branch in your public web folder. Now, that's instant deployment!You can avoid pulling the repo everytime if you create a hook. In Ubuntu real quick, with default LAMP stack: git init --bare --shared=group /srv/git/app.git mkdir /var/www/app chown -R www-data:www-data /srv/git/app.git /var/www/app chmod -R g+rw /srv/git/app.git /var/www/app vim /srv/git/app.git/hooks/post-receive #!/bin/sh export GIT_WORK_TREE=/var/www/app git checkout -f dev # dev branch cd /var/www/app # Run com…
This was just a little post using pull as the simplest example possible. It's a part of a toy project I'm working on and I didn't want to go in too deep...