Global configuration
# initial configuration
git config --global "your@email"
git config --global "Your Name"
git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=3600'
git config --global http.sslVerify false
Init project
# init git in your project and make first commit
git init
git add .
git commit -m first

add prod and dev nodes
git remote add app1 ssh://user@
git remote add app1-dev ssh://user@
git remote add origin https://git.yourdomain/yourname/project.git
git remote -v
on prod and dev nodes make bare repos
# init
cd /data/www/
git init --bare .git
# create hook script
cat << EOF >> .git/hooks/post-receive
git --work-tree=/data/www/ --git-dir=/data/www/ checkout -f
chown -R apache. /data/www/
chmod +x .git/hooks/post-receive
and the same on dev path

push content to prod or dev
git push app1 master
git push app1-dev master
push to git server
git push origin master
fetch commits
git pull origin master
versioning with tags
git tag -a v1.0.0 -m "release v1.0.0"
git push --tags
Automating with Makefile
# Deploy script

PREFIX=$(shell date +"%Y%m%d%H%M")-$(shell whoami)

all: commit deploy

        @echo "========== COMMITING CHANGES ========================="
        @git add .
        @git commit -m "commit-$(PREFIX)"
        @git push origin

deploy: deploy-app1

        @echo "========== DEPLOYING TO PRODUCTION APP1 =============="
        @git push app1

        @echo "========== DEPLOYING TO PRODUCTION APP2 =============="
        @git push app2