Skip to content

Instantly share code, notes, and snippets.

@SuperSarkar
Last active June 26, 2018 03:58
Show Gist options
  • Select an option

  • Save SuperSarkar/b54ca5c7a8b49450cf07d04e9680f225 to your computer and use it in GitHub Desktop.

Select an option

Save SuperSarkar/b54ca5c7a8b49450cf07d04e9680f225 to your computer and use it in GitHub Desktop.
  1. Create a Bare Repo on Server
ssh kunal@domain.com
mkdir website.git
cd website.git
git init --bare
  1. Create a Hook to copy files from the bare git directory to the nginx/apache website directory
cd hooks
mv post-update.sample post-update
nano post-update

Update the "post-update" hook with following content:

git --work-tree=/var/www/html/domain.com/public_html --git-dir=/home/kunal/website.git checkout -g
  1. Initialize the local repo:
cd proj
git init
git add .
git commit -m "First commit"
  1. Push to Server
git remote add origin kunal@ipaddress:/home/kunal/website.git
git push origin master

If you are using SSH keys to login to the server, make sure "pageant" is running with the keys added to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment