When working with a team on a programming task, source control becomes a necessity and Git is the dominating force in this area. So today I'll be covering how to set up your remote Git repo to work with your Visual Studio projects. It's a relatively straightforward process that requires some knowledge of how the Git commands transfer over to Visual Studio menu's and options and dialogs and such.
Setup Your Remote Repo
There are numerous online Git solutions for you to choose from. Some are free, and some not so much. Github for example offers free hosting, but only for public projects. So if you're thinking of running your business on it, then maybe paying the 7$ a month would be the right way to go. Another popular choice is Bitbucket, because it is free for small teams of up to 5 users. Each host provides their own way to set up a new repo, so choose your poison and create yourself a new test repo accordingly.
Add Your Solution To Source Control
Once your remote repo is setup, it is time to sync up your Visual Studio project with that particular repo. And Visual Studio 2015 makes that pretty easy for us to do that.
You'll be given 2 options after that, in order to select which version control you would like to use. Visual Studio Team Services currently only supports the Team Foundation Version Control and Git. I'll be using Git for the remainder of the example.
We should now have a brand new shiny local repo for our code to reside in. And the solutions files should have an icon next to them as such:
So at this point, we should have a remote empty repo over at BitBucket or Github, or whichever host we chose, and a local empty repo as well. Next up, we'll want to make our first commit into our local, which will include our entire solution pretty much.
All of our repo functionality can be found in the Team Explorer tab pictured below.
This is where you can see the changes that have been made since the last sync and where you can push that code to both the local and the remote repository.
As soon as we commit locally, we are given the option to publish our changes to a remote server.
So let's click on sync and we'll get the following publishing dialog.
Let's enter our remote repo path, which should be given somewhere on the Git host, and we'll then be asked for the credentials to the account. Once that is verified, you will get a progress bar keeping track of the changes and a hopeful success message at the end.
So overall, it's a pretty straightforward process in order to get Visual Studio solutions published on a remote Git repository. Microsoft did a pretty good job and streamlining the entire process, although some of the wording in the IDE might be a bit confusing for someone trying it out for the first time. So hopefully this helps someone out that's having a hard time with just that.
Walter Guevara is a Computer Scientist, software engineer, startup founder and previous mentor for a coding bootcamp. He has been creating software for the past 20 years.
Last updated on:
Have a question on this article?
You can leave me a question on this particular article (or any other really).
Ask a question