Sunday, July 13, 2008

Setting up GIT public repository

I found setting up GIT public repository by copying the Rail application to the origin server doesn't allow tags to be pushed.

This lists the steps I took to set up GIT public repository that allows tags (or all GIT objects, I think) to be pushed.

1. Create bare GIT repository from the Rails app I want to create a repository for.

$ git clone --bare rails_app rails_app.git

2. Make the repository to be sharable by GIT daemon just in case I want to do so.

$ touch rails_app.git/git-daemon-export-ok

3. Tar it and scp to the server where I want to have the public repository, which becomes the origin server.

$ tar cvfjp rails_app.git.tar.bz2 rails_app.git

$ scp rails_app.git.tar.bz2 @:~

4. In the origin server, add a new user called "git".

$ sudo adduser git

5. Change the shell for "git" to git-shell.

$ sudo vim /etc/passwd

git:x:1001:1001:,,,:/home/git:/usr/bin/git-shell

6. In the origin server, create git directory under /var.

$ sudo mkdir git

$ cd git

7. Untar the tar file.

$ sudo tar xvfjp ~/rails_app.git.tar.bz2

8. Change the owner of "git" directory to "git".

$ cd ..

$ sudo chown -R git:git git

No comments: