ProgrammingJavascriptCareerProductivityGadgetsASP.NETWeb Design

Setting Up Git Remotely on BitBucket and Visual Studio

Written by
Published on
Modified on
Filed under
Setting Up Git Remotely on BitBucket and Visual Studio

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.

Setting Up Git Remotely In Visual Studio

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.

Setting Up Git Remotely In Visual Studio

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:

Setting Up Git Remotely In Visual Studio

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.

Setting Up Git Remotely In Visual Studio

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.

Setting Up Git Remotely In Visual Studio

As soon as we commit locally, we are given the option to publish our changes to a remote server.

Setting Up Git Remotely In Visual Studio

So let's click on sync and we'll get the following publishing dialog.

Setting Up Git Remotely In Visual Studio

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 software engineer, startup founder and currently teaches programming for a coding bootcamp. He is currently building things that don't yet exist.

Comments

No messages posted yet

Developer Poll

Q:

Stay up to date

Sign up for my FREE newsletter. Get informed of the latest happenings in the programming world.

Add a comment

Keep me up to date on the latest programming news
Add Comment

Stay up to date

Get informed of the latest happenings in the programming world.

No thanks