Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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