Skip to content

Instantly share code, notes, and snippets.

Last active November 4, 2018 07:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Website hosting with Git, support material for
# see for the full picture
# create remote repository
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
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 and
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment