Skip to content

Instantly share code, notes, and snippets.

@zentralwerkstatt
Last active April 14, 2020 09:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zentralwerkstatt/2ae7f4102c8aa9421b1c95d817d56da6 to your computer and use it in GitHub Desktop.
Save zentralwerkstatt/2ae7f4102c8aa9421b1c95d817d56da6 to your computer and use it in GitHub Desktop.
Set up a "GitHub Pages"-style repository on a server
  • On the server:
sudo apt-get install git-core
cd ~
mkdir repo.git
cd repo.git
git init --bare
nano hooks/post-receive
  git --git-dir /home/user/repo/.git --work-tree /home/user/repo pull origin master
chmod +x hooks/post-receive
cd ..
mkdir repo
cd repo
git init
git remote add origin ../repo.git
  • On the client:
cd ~
mkdir repo
cd repo
git init
git remote add origin ssh://user@server:/home/user/repo.git
git add file
git commit -m "Message"
git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment