Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Simple guide to set up new project in SourceTree and BitBucket and link them?

PatrickRyder March 2, 2018

Is there a tutorial or guide anywhere that explains how to set up a completely new project in a new repository, using SourceTree locally linked to my BitBucket remote?

This is such a common scenario, I really must be missing something simple because I have been trying all morning to do this and I just can't get it set up.

I'm not bothered which one comes first: I can set up BitBucket first or set up my local repo first.  I've tried both ways and just can't get it to work.

Any help would be very much appreciated.

Kind wishes ~ Patrick

PS - I have asked a similar question to this before but I can't find my question.  Is there a way to find questions you have asked on the forum?

1 answer

3 votes
Deleted user March 2, 2018

Okay, this worked for me.  This assumes you are using Visual Studio, but almost of all of these instructions are not specific to Visual Studio.

  1. Create a folder where the project is really going to go on disk.
  2. Create another folder where the project can be created temporarily, until its files are added to source control.
  3. In BitBucket, create a new repository.
  4. Optionally add a 'ReadMe.txt' and a '.gitignore'.
  5. Add a develop branch.
  6. In SourceTree, select Remote and choose the appropriate user account if you have more than one.
  7. The new repository you have just created in BitBucket should appear.
  8. The Clone link next to it does not appear to work, so highlight the repository and select the Clone button at the top of the screen. Once in this manual entry, you can cancel and go back out to the list of repositories and the Clone link should now work.  (This appears to be a bug, at least on my set-up.)
  9. Accept or manually type the remote URL, which will be something like 'https://bitbucket.org/username/gittutorial.git.
  10. Choose the real project location for the local path.
  11. Click Clone.
  12. Select the Log/History tab. This should show the 'ReadMe.txt' file that was created in BitBucket. It should have the following branches: master, origin/master, origin/develop and origin/HEAD.
  13. Right-click REMOTES | origin | develop and select 'Checkout'. This should create a local branch develop which tracks origin/develop.
  14. Create a new VS project in the directory created in (2) and copy the project files into the folder that is under source control.
  15. These can now be staged and committed to form the first commit of the new project.
  16. When the solution is now opened in Visual Studio, it should automatically recognise that the code is under Git source control.

Hope this helps someone.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events