Skip to content

Instantly share code, notes, and snippets.

@nabe256
Created November 2, 2014 09:36
Show Gist options
  • Save nabe256/3a927ee6da681ef3cc5a to your computer and use it in GitHub Desktop.
Save nabe256/3a927ee6da681ef3cc5a to your computer and use it in GitHub Desktop.
git bare repository
$ cd /var/git
(a)
$ git clone --bare /var/www/html/project project.git
(b)
$ mkdir project.git ; sudo chown -R user:user project.git
$ cd project.git ; git init --bare
$ cd /var/www/html/project ; git push /var/git/project.git master
$ cd /var/git/project.git
$ vi hooks/post-receive
#!/bin/sh
git --work-tree=/var/www/html/test --git-dir=/var/www/html/test/.git pull /var/git/test.git
$ chmod +x hooks/post-receive
client$ git clone server:/var/git/project.git project
client$ git clone ssh://server/var/git/test.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment