Host your own Code Repository (GIT)

Code Repositories

As all developers know, Murphys Laws is a powerful guide to keep in mind and help us (in one way or the other) to prevent big catastrophes. Maybe I’m exaggerating a bit, but you all get the point.

Until a few years back i didn’t use code repositories, more exactly control version system. I didn’t use it, didn’t need it and most of all I didn’t knew of their existence (Ye, shame on me). But when I went to college, I felt the need to backup all my work, after all the teachers didn’t care about the “I hard drive died” or “my computer went kaboom” excuses.

So i started my investigation about code repositories. I found out about CVS, but it was starting to be discontinued and I couldn’t find any free CVS repositories. Next I found SVN, seems promessing, Google has SVN repositories free and with some configuration you can turn them to private, add users, etc. Felt great and I used them for a few years. Although it has many vantages, there was not much system explorer integration and I used them both in Linux and Windows, or even great integration with Eclipse and Netbeans. Maybe is was a big idiot, but times to times i had some trouble and didn’t had my code at the latest state. I assume, my low experience and lack of method provided my biggest headaches.

After a few years, it came to my attention the existence of another flavour: the GIT. One distributed VCS with great functionalities and make me wonder how is the feeling of working with it. Well is great, i don’t want anything else (by now :P).[Some comparison  about them both:] By searching for git hosting, i found out about github (which is free and the repositories are public) and bitbucket (also free and the repositories are both public and private). There are many others out there:

This is great but … … … they are hosted in the Internet. In some contexts it is not desired that we have the repositories in Internet, but we need, no, we want one repository to control version of our work but, unfortunately, there is no repository “in house”. In this “tutorial” ( explains how to setup a git server, but in my humble opinion is a bit complex for a simple, one project repository, so I searched a little more.

I looked at GIT documentation (yes, it’s true. Sometimes I read the manual :P) and noticed about the “git init –bare” command, that provide a local repository, which is great. So if you have a shared (and mapped) network drive, an external drive you can initiate a repository and them you can work as usual, by cloning, commiting and push actions.

Nice, right?

I also found this article by Jimmy Theis ( which explains how to use your dropbox account to backup your repositories. Although I didn’t tried with others storage hosting, i believe that should work with Onedrive service also.
Some considerations, learned by the hard way:

  • While working, commit each functionality that you are working. One at the time. If something was buggy, it’s is easier to “undo” one commit rather then “undo” multiple functionalities in one commit.
  • Commit often, push once. Since you don’t need to be connected to “commit”, you can “commit” as often you need to accomplish your goal. At the end, just “push”.
  • Although you don’t need any application beside GIT to the work, sometime is a pain doing the work in command line. I suggest the usage of a GIT client. I use Atlassian SourceTree (, it is great and work both in Windows and Mac. It helps you to keep track about your repositories and can sync with github and bitbucket.
  • If you like and want to use the command line, don’t forget to add files before committing. They are not added by default.
  • GitIgnore is your friend. Use it and abuse it. This functionality help you to keep out of track unneeded  files. Very helpful in Visual Studio projects.
  • Don’t forget, just don’t, to add to GitIgnore any file that you have containing usernames, passwords, connection strings, etc. One in the Web, you can’t control who sees it, an by a security measure you have to change all services credentials. A huge pain in the head. 😛

Just a few insights to those who are a bit distracted 🙂

Keep it tuned.


Git && GoogleCode Git Repository in Windows

Since 2008 I use google code project hosting as repository for my college projects and backup. I used SVN as source control and didn’t had to much proble, except working, updating and committing changes in two distinct operating systems (Windows and Linux).

All went well until now.

Why? May you ask…

As you may know (or not) GoogleCode has  for quite some time Git support for version control.

Well, this semester i have a course named “Internet Programming” where we will use git as source control and github as repository and so on. So far so good.

Since, by default, i always use source control, it doesn’t make since to me use multiple source control at the same time. There is no problem in doing that, but i’m a little lazy :-). Since i’m gonna use git for that course and i have source control within google code and google code has git support then let start using git in google code :-).

Make some sense.

Since in that same course we eventually gonna programming in ASP.NET MVC 3, we gonna need MS Visual Studio. Therefor, MS Windows. And we all know, MS Windows is not Unix and does not quite work in the same way.

I spent almost one day to found a way to update/commit/push/pull without having the annoince of giving the username and password. Thanks to Milton Keynes Blog and tips i made it.

This is how:

[ ]Step 1:

Get your credential from your googlecode account:

[ ]Step 2:

Get and install all necessary software:

[ ]Step 3:

Adicional Configurations:
  • make a new folder, with we gonna call home. I suggest unix structure: c:\home\your_user
  • In Windows Enveriment Settings :Variable: HOME, Value: c:\home\your_user
  • Make a new file in c:\home\your_user\_netrc. This file gonna keep your google code project credential. Yes is _netrc and not .netrc .
  • Paste the follow line, making the necessary changes:


And the magic is made. Now i can push changes without insert username and password.