Click here to Skip to main content
14,159,205 members
Click here to Skip to main content
Add your own
alternative version


26 bookmarked
Posted 25 Apr 2015
Licenced CPOL

Getting started with GIT, Visual Studio, and BitBucket

, 25 Apr 2015
Rate this:
Please Sign up or sign in to vote.
Getting started with GIT, Visual Studio, and BitBucket isn't difficult - but it can take a bit of working out. Here is a simple explanation of what to do to get a new project under source control.


Source Control. Next to a good solid backup system, it's the best friend a developer can have! Well, if you ignore the IDE, of course.

But... it can be confusing to get set up, particularly if (like me) you don't have to do it often - so each time you try, you forgot what took you all day to work out last time...:sigh:...I know I do.

So here is a simple, step-by-step guide to getting it done.


This assumes you are using Visual Studio 2013 Community Edition, and that you have the "Microsoft Git Provider" plug-in set up and selected ("Tools...Options", "Source Control...Plug-in Selection", "Current source control plug-in" to check and select if needed.) If you don't have the plug-in installed yet, go here: MSDN[^]  

This also assumes you have set up an account with BitBucket[^] and can log in and create repositories. If you haven't, do this first!

Getting Started

Create the Project and Local Repository

Open Visual Studio, and select "File... NewProject"

Select the project type as normal, give it an appropriate name and solution name, then tick the box "Create new Git Repository" before pressing "OK".

Open the "Solution Explorer" pane, and commit your project:

  • Right click the Solution name, and select "Commit..." from the context menu.
  • This will open the "Team Explorer" pane. Enter a commit message where it prompts you to do so. (Until you do, it won't enable the "Commit" button). "Initial creation" is a good idea!
  • Press the "Commit" button.

Create the Remote Repository

Sign in to your BitBucket account and use the top menu: "Create...Create repository".

The form that appears lets you set up the repository: you need a Name, a Description is a good idea, and the rest is up to you! :laugh:

Press the "Create Repository" button.

When the Repository is ready, click "I have an existing project". This will show you the PUSH command detail you need:

cd /path/to/my/repo
git remote add origin
git push -u origin --all # pushes up the repo and its refs for the first time
git push -u origin --tags # pushes up any tags

The bit you need is the URL - from the second line in this example:

Copy that to the clipboard.

Back to Visual Studio

In the Team Explorer pane, use the top dropdown (Probably currently showing "Changes") to select "Unsynced Commits". This will bring up the page with "Publish to Remote Repository".

Paste the URL you copied from BitBucket where prompted: "Enter the URL of an empty GIT repo" and press "Publish". It won't take long - or it shouldn't with a new project, there isn't a lot there - when it's finished you are done.

Back to BitBucket to Check

Click the "Source" button on the left hand side and Presto! your project is in the Repository.


One thing that caught me out immediately after writing this, was that the default gitignore file is set to discard any files starting with "Backup" - so you should avoid calling your projects, classes, or any files with them anything started with "Backup" if you want them under Source Control. It's well worth the occasional check on your BitBucket Repository to check that all your files are included as there is no visual clue anywhere else that they aren't... :swearword: :swearword: :swearword:

One of the main reasons for having source control is to share code with associates. Please, remember the Cardinal Sin of Source Control and never commit code that doesn't compile! You will annoy people to the point of them forming a lynch mob... :laugh:


  • 2015-04-25 First version
  • 2015-04-26 Typos, and added "Backup" filename warning


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Wales Wales
Born at an early age, he grew older. At the same time, his hair grew longer, and was tied up behind his head.
Has problems spelling the word "the".
Invented the portable cat-flap.
Currently, has not died yet. Or has he?

You may also be interested in...


Comments and Discussions

QuestionIs visual studio community ed. 2017 ignoring .gitignore Pin
Member 122936975-Sep-17 1:09
memberMember 122936975-Sep-17 1:09 
QuestionWonderful Pin
MosuliNodangala1-Sep-17 23:48
memberMosuliNodangala1-Sep-17 23:48 
PraiseThanks a lot Pin
Majid Basirati26-Jun-16 3:26
memberMajid Basirati26-Jun-16 3:26 
GeneralRe: Thanks a lot Pin
OriginalGriff26-Jun-16 3:39
protectorOriginalGriff26-Jun-16 3:39 
QuestionThanks for the warning! Pin
Programazing22-Nov-15 7:44
memberProgramazing22-Nov-15 7:44 
AnswerRe: Thanks for the warning! Pin
OriginalGriff22-Nov-15 8:03
protectorOriginalGriff22-Nov-15 8:03 
PraiseMany thanks Pin
Tom Ash27-Oct-15 11:08
memberTom Ash27-Oct-15 11:08 
GeneralRe: Many thanks Pin
OriginalGriff27-Oct-15 11:21
protectorOriginalGriff27-Oct-15 11:21 
QuestionGreat! Pin
PsylenceDave18-Sep-15 2:08
memberPsylenceDave18-Sep-15 2:08 
Helped me set up my first BitBucket repository Smile | :)
GeneralThanks! Pin
olafdonk17-Jun-15 22:34
memberolafdonk17-Jun-15 22:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web01 | 2.8.190518.1 | Last Updated 25 Apr 2015
Article Copyright 2015 by OriginalGriff
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid