Simple tools for git auto deploy in linux

miles@Oscar b6cce04806 tiny changes 9 yıl önce
README.md b6cce04806 tiny changes 9 yıl önce
auto_deploy.sh b6cce04806 tiny changes 9 yıl önce
index.php b6cce04806 tiny changes 9 yıl önce
post-receive.sample 8d769eff8c init 9 yıl önce

README.md

Git Auto Deploy

Simple tools for git auto deploy in linux

Settings

Githooks

Copy the contents in post-receive.sample to your server's hooks, you may replace the url and token with your own settings

Server

Put the files auto_deploy.sh and index.php to your website in the same directory. For example, you may access index.php from the url http://myweb.com/auto_deploy/index.php, also it is to-post url in the githooks

Replace your deploy path in auto_deploy.sh by setting the path value

Replace your toCheckToken and validIP in index.php

Permission

Web user should have permission to run the git command! Let's say that your nginx user is www (of course you can check this by exec(whoami)), and it's recommended ssh key of www should be added to this project's SSH deploy key. For example:

sudo -u www ssh-keygen -t rsa -C "YOUR_COMMENT"

Use above suggestion incase your web user is set to nologin via ssh

Usage

Just with the text [deploy] included in your commit message, like

git commit -m "Bug fix [deploy]"
git push

Remote handle message may show to you while pushing.

FYI

exec function is required in php.ini