How to import a FOSS project into Gitorious

By xtingray

This is a pretty little article about my experience importing the Tupi's source code to the Gitorious repository.

I promised to myself to write this guide, after getting mad looking for a simple/short procedure to start working with GIT, counting on I'm coming from the SVN school.

Gitorious is a very nice open repository for FOSS projects, using GIT as distributed control revision system (DCRS), it's a pretty cool place where you can exchange code and experiences with a lot of friendly programmers around the world.

The first step to join the party is to open a free account in Gitorious. The registration process is quite simple and you just have to confirm your request by email. That's all!

As registered user, you can create software projects from the site interface, filling a simple form. For every project created, you'll have access automatically to a GIT repository.

My problems started at this point: How to import my project source code to the GIT server? (I'm assuming you already know the basics about GIT).

Well, after reading a lot of large manuals and try some different commands in many ways, I found the right procedure and here is:

1. After you have created your project, your repository is initialized but with no data. Choose a place from your file system, where you want to play:
% mkdir tmp
% cd tmp

2. Then, get a copy of your "empty" project. In my case and for this example, it's called "tupi":
% git clone git@gitorious.org:tupi/tupi.git

3. A directory with your project's name will be created. Move into it:
% cd tupi/

4. Create a branch called "master" in your repository from Gitorious, running:
% git remote add master git@gitorious.org:tupi/tupi.git

5. Copy all your project's source code inside the current directory:
% cp -rv /path/to/your/code/tupi/* .

6. Add the new files to this branch (master):
% git add .

7. Commit this change, I mean, commit all the files you have copied one minute ago:
% git commit -a

8. Update your project in the Gitorious repository:
% git push --all

9. If everything goes well, you'll be able to browse your code from the Gitorious website, just like this:

http://gitorious.org/tupi/tupi/trees/master

From this point, you could start working in your project making changes to your code, creating patches, running commits or whatever you need using GIT.

These are some additional resources about it that might be useful for you:
- http://www.kernel.org/pub/software/scm/git/docs/user-manual.html
- http://wiki.freegeek.org/index.php/Git_for_dummies
- http://nvie.com/posts/a-successful-git-branching-model
- https://gitorious.org/joomleague/pages/En-Workflow_personal

PS: I hope this small text can save someone's life some day XD