Git post receive setup at server for git push to the production from local machine

IN SERVER
  • cd www
  • mkdir repo
  • cd repo
  • mkdir app.website.git
  • cd app.website.git
  • git init –bare
  • cd hooks
  • touch post-receive
  • chmod R 775 post-receive
  • put the following line in post-receive file
    git --work-tree=/var/www/html/app.website.com --git-dir=/var/www/repo/app.website.git checkout master -f

  • cd /var/www/html/app.website.com
  • nano /etc/hosts
  • 127.0.1.1 app.website.com
  • cd /etc /apach2 /site-available
  • cp 000-deault.conf app.website.com.conf

LOCALLY

  • git remote -v
  • git remote add prod-website ssh://root@192.168.0.1:/var/www/repo/app.website.git

Comments

Popular posts from this blog

Deploy laravel application to digital ocean droplet