Follow this blog

Thursday, May 22, 2014

.NET project on online Source control

Visual Studio 2013 express have a option to add your project to Source Control. It is easy to add project to local repository location. In this article you will find step by step tutorial how to add your project to free private Source control located on the internet.

Bitbucket supports private or public Git/Mercurial repositories up to 5 users.

Why you need online Source control Repository?

Let's say you developing your project and one day your computer crash down. It is pity to lose all your development effort till this point. So if you have local Source Control repository you will lost everything. But if you have online repository you could continue to work from your last check in on other computer.

Of course, there are other reasons why you should use online Source safe like sharing work and code with other people who are distant from you but in my case online backup is main reason to use online source control.

Step by step guide for online Source Control with Visual Studio 2013 express
  • To add your project to Source control click FILE --> Add to Source Control



  • Choose Git radio button and click OK

  • If you get error like this: "The current solution has projects that are located outside the solution folder. These projects will not be source controlled in the Git repository..." check Add ASP .NET Empty Web Site to Git Source control

  • Open Team Explorer, VIEW --> Team Explorer

  • Choose Changes in dropdown of Team Explorer window



  • Commit to local GIT, enter the comment (eg. "Initial Commit") and choose Commit from dropdown



  • Click on "Unsynced Commits"



  • Now you need to enter URL of an empty GIT repo, to get this URL you need to create account on Bitbucket

    • Creating Bitbucket repository

    • Go to Bitbucket and Sign up for free

    • Click on button Create to create new Bitbucket repository


    • enter Name, Description, Access level (in this sample I checked private repostiroy checkbox), Repository type (Git) and Language (C#)

    • after Create repository button is clicked you create new repository

    • next step is to copy URL,
      URL is in format :
      https://bitbucket.org/[ProfileName]/[RepoName]
      So if my profile on bitbucket is Me URL will be:
      https://bitbucket.org/Me/newwebsite

    • let's go back on Visual Studio 2013

  • In Visaul Studio in Team Explorer paste link of your BitBucket Repository and click Pubish


  • Enter you BitBucket username and password if you are asked. If everything is ok you will see meassage : "The origin remote has been added and the current branch has been published."

  • If you click Sync button your code will be synced on online BitBucket location

  • You can check it by going on BitBucket web page, choose repository and clicking Source under Navigation tab.

No comments: