Thursday, August 22, 2013

Publishing a new git respositary

On the server (if not already done)

mkdir /git
chown root:root /git
chmod 1777 /git

Say you have a source tree on your client in bar to be published as foo.git

git init --bare foo.git
scp -Cr foo.git server:/git/foo.git
rm -rf foo.git
git clone server:/git/foo.git
cd foo
cp -R ../bar/* .
git add .
git commit -m "Initialisation"
git push origin master


All done.  On a third machine "git clone server:/git/foo.git" should now work and you can git pull, add, commit and push to your heart's delight.

No comments:

Post a Comment