su
cd /var/www/
mkdir site
cd /var
mkdir repo && cd repo
mkdir site.git && cd site.git
git init --bare
cd hooks
cat > post-receive
chmod +x post-receive
#!/bin/sh
git --work-tree=/var/www/site --git-dir=/var/repo/site.git checkout -f
(Press Ctrl+D to exit)
mkdir project
cd project
git init
touch file
git add .
git commit - m "Add project"
git remote add beta ssh://[email protected]:port/var/repo/site.git
git push remote master
ssh [email protected]:port
cd /var/repo/site.git
sudo chmod -R g+ws *
sudo chgrp -R mygroup *
git config core.sharedRepository true
Thanks for this clean solution.