Last active
November 4, 2018 07:55
-
-
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/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see https://frightanic.com/web-authoring/website-hosting-with-git-a-tutorial/ for the full picture | |
# | |
# create remote repository | |
ssh [email protected] | |
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 [email protected] | |
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