Creating a new Git repository
Posted on quarta-feira, abril 30th, 2008 at 17:40= Git working tree repository =
Creating a new repository from scratch
$ mkdir /home/ragner/myproject
$ cd /home/ragner/myproject
$ git-init
If you have some initial content (say, a tarball):
$ tar -xzvf myproject.tar.gz
$ cd myproject
$ git-init
$ git-add . # include everything below ./ in the first commit:
$ git-commit
= Git “bare” shared repository =
Creating a new “bare” repository(a repository without a working tree)
$ mkdir /pub/my-repo.git
$ cd /pub/my-repo.git
$ git --bare init --shared # gives every team member read/write access to this repository.
or
$ git --bare init --shared=group-name # gives every “group-name” member read/write access to this repository.
now you can push your base tree
$ cd /home/ragner/myproject
$ git-push /pub/my-repo.git master
and put the repository as origin to .git/config in your local work tree, as the follow lines:
–
[remote "origin"]
url = /pub/my-repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
–
or just run:
$ git-remote add origin /pub/my-repo.git
References:
http://www.kernel.org/pub/software/scm/git/docs/cvs-migration.html
http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#Developing-with-git
