• info@happli.be

Move an existing Git Repository to Visual Studio Team Services

Move an existing Git Repository to Visual Studio Team Services

Say you’ve been working on a project for a while. That project is not an open-source project. The source code is private and owned by your customer. You’ve been working alone so far, thus having a Git Repository hosted on a NAS and exposed through some VPN or WebDAV way (http://happliblog.azurewebsites.net/2015/09/07/setup-git-on-synology/) used to work a threat.

But someone joins the project. You have to give him access to the project’s source code, but you don’t want him to reach your NAS (additional trafic, security risks…). So you think about moving your repository to an online hosting. Several options exist out there. I considered two of them: GitHub and Visual Studio Team Services.

This post describes the platform I choose and how I “uploaded” my repository to the chosen hosting service. It then show how to add a team member using the selected platform.

GitHub vs VS Team Services


Neither solution are free.

GitHub has a free offer for public repositories. But this isn’t an option if your code must remain private. Paying for the private repositories will cost you 7$/month.

GitHub pricing Details

GitHub pricing Details (https://github.com/pricing/plans)

Visual Studio Team Services (VSTS) is free for up to 5 users. Repositories are private.

Visual Studio Team Services pricing details

Visual Studio Team Services pricing details (https://www.visualstudio.com/pricing/visual-studio-team-services-pricing-vs)

As long as your team remains small (max 5 team members), Visual Studio Team Services is your best bet on the price side of things.


Besides Git-base source code hosting, both platforms come with additional features. Here’s a subset of them. I’m not including advanced features like API

GitHUB has (https://github.com/features):

  • Issues tracking, with a nice commit-to-issue linking system
  • Pull requests: a kind of advanced collaborative mechanism. After collaborators have worked on a branch, when they want their changes to be integrated into the product’s main branch, they fill a pull request which contains code, comments and issues. It allows grouping information about a set of changes.
  • API (https://developer.github.com/v3/)
  • Syntax highlighting when browsing code in web views
  • Integrated Web Pages for blogging about a project… (https://pages.github.com/)

VSTS has (https://www.visualstudio.com/en-us/products/visual-studio-team-services-feature-matrix-vs.aspx):


Given that we’re only two team members working on the code  and I want to keep a private repository, Visual Studio Team Services wins on the pricing side of things.

On the feature side of things, Visual Studio Team Services offers a nice agile development process support. On the other hand, GitHub has a cool web pages offer. But the integrated CI feature of Visual Studio Team Services makes it my preference (less time spent configuring a CI system).

This project doesn’t involve a large organization nor specific integration with external tools. So I didn’t care about team management features nor about API’s exposed by the platforms.

So I went for Visual Studio Team Services.

Moving the existing repository to the hosted repository

Git and its ease of adding remote repositories allows for a smooth transition from a private repository to a more robust hosted one. In that way, it helps support scaling of the project.

Start by making sure you’ve got a clone of your existing repository on your local machine.

Given an existing Visual Studio Team Services account, create a project from that account (select Git as the versioning system). Then, navigate to the “code” tab of your project (see below).

VSTS Code Tab

VSTS Code Tab

You’ll get something like below. Start by generating Git Credentials (click on the button highlighted).

Generate Git Credentials

VSTS Generate Git Credentials

Once the credentials are generated, scroll down and you’ll find out how to push an existing Git repository to the VSTS hosted Git repository, as illustrated below.

Push Existing Repository To Another One

Push Existing Repository To Another One

Using your command line, navigate to the Git Repository that you’d like to “publish” to Visual Studio Team Services. Then execute the two commands above. Pay attention:

  • You might want to change “Origin” to some other name (if your local repository is a clone of another origin).
  • Don’t forget to change the URL in order to match your new repository’s name (in the screenshot above, the repository name is “test”).
  • You will need to specify the Git Credentials you’ve just created.

Git will do its job and push all the source code (including all branches) to Visual Studio Team Services. Go back to your browser and you should see the code. I didn’t even have to refresh the webpage!

Next step: adding the new contributor to the list of team members on VSTS.

Adding the new contributor

Adding the new contributor to the project is done on the project’s home page. Simply click on the “Team Members” panel (highlighted below) and then specify the new member’s e-mail address.

VSTS Project Team Members

VSTS Project Team Members