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