Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@marcelstoer
Last active November 4, 2018 07:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcelstoer/3c920de9f9a3659cfb386ee56d85bd88 to your computer and use it in GitHub Desktop.
Save marcelstoer/3c920de9f9a3659cfb386ee56d85bd88 to your computer and use it in GitHub Desktop.
Website hosting with Git, support material for https://frightanic.com/web-authoring/website-hosting-with-git-a-tutorial/
# see https://frightanic.com/web-authoring/website-hosting-with-git-a-tutorial/ for the full picture
#
# create remote repository
ssh user@host.com
mkdir repos
cd repos
mkdir example.git
cd example.git
git --bare init
# create local clone on development machine
git clone ssh://user@host/~/repos/example.git
cd example
touch README
git add README
git commit -m "Init"
git push origin master
# clone repository on web host into website folder
ssh user@host.com
cd www
git clone ~/repos/example.git
# create post-receive hook
cd ~/repos/example.git
cd .git/hooks
touch post-receive
chmod +x post-receive
vi post-receive
# make the hook update the local clone
#!/usr/bin/env bash
cd /home/user/www/example
git fetch
git reset --hard origin/master
# input from https://gist.github.com/Nilpo/8ed5e44be00d6cf21f22#su and http://toroid.org/git-website-howto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment