How to Deploy a Website to a Remote Server Using GIT

UsingĀ git to deploy your website to your remote server

  1.  ssh into your server and make a directory.

    mkdir -p /var/repo/website.git
  2. cd /var/repo/website.git/
    git init --bare
  3. cd hooks
    nano post-receive
  4. #!/bin/sh
    git --work-tree=path_to_website_folder --git-dir=path_to_git_directory checkout -f name_of_branch
  1. chmod +x post-receive
  2. git init git remote add name_of_repository ssh://your_user@server_ip_address/path_to_git_directory
  3. git push name_of_repository name_of_branch
Facebook Comments

You may also like