I blogged about this on my site. Below are the directions that I give to students to get these three technologies (BitBucket, SourceTree and Visual Studio) to work together. Please remember some of the instructions here are very specific about things like the path to set simply because when I have 12 people all doing the same thing I need to make sure that everyone does it the same. Change these things to fit your need. You can view this post on my blog to download a PDF file of these instructions which also contains pictures. http://webdevbeyondtheclassroom.wordpress.com/2014/10/22/using-source-control-with-bitbucket-source-tree-and-visual-studio-part-1/
Account Setup
Install Git
- In a web browser open up www.git-scm.com
- Click the “Downloads for Windows” button
- After downloading, install Git using all of the preselected defaults
Installing Source Tree
- In a web browser open up www.sourcetreeapp.com
- Click the “Download SourceTree Free” button
- After downloading, install SourceTree using all of the preselected defaults
Create Bit Bucket Account
- In a web browser open up www.bitbucket.org
- Enter your information into the sign up form on the front page and click “Sign up for free”
- Enter all your information and follow all sign up instructions
- At the “Create Your First Repository” screen click No Thanks
Repository Creation
Creating a Repository on BitBucket and Cloning in SourceTree
- Open and sign in to www.bitbucket.org if you are not already there
- At the top click on the “Repository” menu option and select “Create repository”
- Enter a new name for your repository (This will be your solution name in Visual Studio)
- Enter a description if desired
- Leave the Access Level checked to make this a private repository
- Leave Repository Type set to Git
- Click the “Create respository” button
- On the next screen click the Clone link on the left hand menu
- Click the Clone in SourceTree button
- The SourceTree application will open with a URL Actions dialog box
- IMPORTANT: Click the ellipse button […] to the right of the Destination Path input box
- In the “Select Destination Path” dialog box navigate to the following location
- C:\\Users[username]\\Documents\\Visual Studio 2012\\Projects
- Create a new folder in this dialog box naming it the same as your repository name
- Double click the new folder and click the Select Folder button
- Back on the URL Actions dialog box click the Clone button
Creating a New Solution in Visual Studio
- Open Visual Studio
- Create a New Project from the start screen or File > New > Project
- Select the Project type that you are going to create
- In the Name box change the default name to the name of the repository you created in bitbucket
- Click the Browse button to the right of the Location box
- Navigate to and double click on the folder you created when you cloned the repository
- C:\\Users[username]\\Documents\\Visual Studio 2012\\Projects[repositoryname]\\
- Leave the checkbox for “Create directory for solution” checked
- Click the OK button.
Initial Project Commit and Push to BitBucket
Commiting Changes in SourceTree
- In SourceTree double click on your newly created project on the left
- Check the box next to Unstaged files
- All the files should transfer to the above pane as Staged files
- Click the Commit button on the top bar
- In the text area that will eventually appear at the bottom of SourceTree enter the commit message of “Initial Commit”
- Click the commit button
Pushing Changes to BitBucket
- In SourceTree click the Push button on the top menu
- On the new dialog box click the master check box
- Click OK
- Click the “Show Full Output” check box to see the Completed successfully message (this will also show you any error messages. NOTE: If you don't when the push is complete, if successful, the box simply goes away.
- When completed click the close button