How To Start ANew Git Repository

From Biowiki
Jump to: navigation, search

How to start a new git repository on cvs.biowiki.org

First, ssh into cvs.biowiki.org and create an empty directory with group write permissions, group sticky bit, and suffix .git

cd /nfs/git
mkdir newrepo.git
chmod g+ws newrepo.git

Now, make it into a git repository

cd newrepo.git
git --bare init

Now logout of cvs.biowiki.org and, on your local machine, do the following to check out the (empty) repository

git clone cvs.biowiki.org:/nfs/git/newrepo

Now you can cd into the new repository, add a file, and do your first commit & push (for this first push, you need to specify the branch, hence the "origin master")

cd newrepo
touch README
git add README
git commit -m "First commit"
git push origin master

For subsequent pushes you don't need to specify the branch

touch DUMMY
git add DUMMY
git commit -m "Second commit"
git push

-- Ian Holmes - 20 Oct 2011