Saturday, 17 May 2014

Set Up Your Personal SVN Repository Server For Free

Did you know you can have a private repository server to host your projects without any cost?  Ohh Yes. You can!! For this tutorial we shall use BitBucket to host a private SVN repository.  Other free host include beanstalkapp and Spring Loops, both of which give you at least one repository, maybe 100mb of space and a few user accounts to play with.  This is great for one project, but when you start another one or if you run out of space, you have to create a new account with a different email address (or different urls, etc..)
Fortunately we have BitBucket where we can host our code online in as many public and private repositories as we want and that for 5 users. Isn't that great!!!
So, firstly sign up on BitBucket (which is free and very easy to do). Once signed in, create a new repository (you can choose from either making the repository private or public).  For the repository type, select 'Mercurial'.  I have made a screenshot to help you with the process.

The next step will be to download the TortoiseHg which is very similar to TortoiseSVN, except that its for Mercurial revision control systems.  So download it and install it on your machine.  Please note after successful installation, it is recommended to restart your machine.

To confirm that TortoiseHg is properly installed on your machine, open command prompt on Windows and type the following command: " C:\> hg".  If you get all the basic command displayed on the command prompt screen, then you are on the right track.

Now here comes probably the harder part. Create a new folder in your Local Disk C directory and name it repository1.  Now on the command prompt, go that newly created directory and type in the commands "C:\repository1>  hg clone https://bitbucketusername@bitbucket.org/bitbucketusername/repositor1".  This url is already provided to you by bitbucket.

Now its time for us to create our first file. So go to your repository1 folder on your local machine and create a new html file. You can call it whatever name your want, for example home.html.  To synchronize the new file with your repository on bitbucket, right click on the file -> TortoiseHg -> Add File. After doing this step, right click again on the folder and click on Hg Commit.

Finally after adding all your required files and after doing all necessary changes, you need to push all the changes to your repository on BitBucket. To do that, just right click anywhere in the repository1 folder and click on Hg Workbench.  Click on the button indicated on the screenshot above to push all the changes to your remote repository.  Congrats!!! You now have a private & personal SVN server without spending a single penny. Good luck with BitBucket and TortoiseHg.

Note: You can view the step-by-step guide for TortoiseHg here.