Tip from the team: configure your repos for hosting goodness!

Supported Platforms

  • macOS
  • Windows

connected.png

We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and Visual Studio Team Services. Previously you could use Sourcetree's standard Git functionality but service specific niceties such as remote repository listings with easy cloning, SSH key management, avatars, and perhaps most importantly pull request creation, weren't available. As of 3.0, that's a thing of the past.

This article will walk you through how to set up Sourcetree with your existing account and configure any already checked out repositories to take advantage of this new functionality šŸš€

Step 1: Adding your account

To set up a new account for a hosting service you go to the Accounts section of Sourcetree's preferences.

accounts.png
When you click the "Add" or "Edit" buttons you're presented with an account dialog. Here you choose which service (GitLab.com in this example) and then enter the appropriate credentials to use for remote interactions such as repository listings. You also choose the default protocol you prefer to use with this service for remote repository interactions; you can also optionally configure and upload an SSH key based on your username if the service supports it.

Edit.png
Once you save the account Sourcetree will automatically set up the remote repositories listing to populate the next time you visit them. Whenever you clone a repository from that list the rest of this article is taken care of for you šŸ˜ƒ

Step 2: Configuring an existing clone of a repository

In the toolbar you'll notice the "Settings" button on the far right. It has a corresponding menu item called "Repository Settingsā€¦" under the Repository menu.

toolbar.png

When you click this you're presented with a dialog containing several sections. We're interested in the "Remotes" section, so click on that. You should see a screen similar to this one.

edit_remote.png

If you double-click on the primary remote (origin in this case) or select it and click the "Edit" button you'll be presented with a second screen. 

edit_remote2.png

On this screen you'll want to update the "Optional extended integration" portion to match your repository's host and then add the username which matches your account. Click "OK" to save these and you're good to go. These changes should take effect immediately - you don't need to restart Sourcetree. If you happen to encounter any issues, try closing and re-opening the repository's window/tab to reload it.

Step 3: There's no step three!

Once the extended integration settings are in place for a repository you're ready to go - right click on your current branch and create a pull request for your latest and greatest changes directly from Sourcetree!

Additional Resources:

7 comments

Gerald Torres October 28, 2018

I'm really happy to hear SourceTree added GitLab to list of hosting service! However I've been having trouble adding my GitLab Account.

I tried adding my GitLab account with HTTPS as the protocol but I always get login errors. I have checked my password and I can confirm I was using the correct credentials. Also, is there a way to insert my private token that i've generated?

My team also can't add their GitLab account on SourceTree. I have the latest version of SourceTree v3.0.

gitlab-sourcetree-login-fail.png

Like ā€¢ benadamstyles likes this
jhanshew October 31, 2018

Confirming the above by Gerald. I also cannot connect via SSH or HTTPS to gitlab.com account. My gitlab.com account does not have 2FA enabled so that's not a factor. I am also running the latest SourceTree, v.3.0.

Like ā€¢ # people like this
bgannin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 6, 2018

Please file bug reports per this article instead of as comments to ensure they're addressed.

Marc Choisnard January 16, 2019

OAuth doesn't work for BitBucket either (Sourcetree 3.0.1) 

Clicking Connect Account SEEMS to work as it sends me to bitbucket's oauth page, but then the account doesn't "stick" or stay connected. 

Trying to sign in the old-fashioned way (username and password) doesn't work either as SourceTree inexplicably requires a NON email address to sign in to bitbucket, but bitbucket REQUIRES an email address to sign in. D'oh!

Finally, trying to add the remote repository directly only generates the dreaded infinite "password required" dialog. Again, it keeps changing my username to the old BitBucket username instead of allowing me to use my email as required.

Welp, off to google now for "Alternatives to Sourcetree". 4 hours of reading and trying unhelpful 'solutions' is enough pain. Maybe someone else has it figured out.

Like ā€¢ # people like this
Ronald Munoz November 3, 2021

For Mac: ( Using GitHub )
This seems to be an issue with Sourtree failing to add the required SSH key to GitHub.

In case you have issues connecting to your account and this is stopping you from pushing changes into your repository simply:


1. In Sourcetree go to Preferences->Accounts->Edit->Copy to Clipboard when you select SSH as your connection protocol.

2. Add the SSH key to your GitHub account. In GitHub go to  Settings->SSH and GPC keys->New SSH key. Here paste the SSH key you copied from Sourcetree.

If you attempt pushing changes into your repository now you should be able to without any problems. 

marcoxa February 11, 2022

Hi

the Github connection with TFA and Auth Tokens is still broken inasmuch as Sourcetree does not properly present the necessary options and does not allow to properly interact with the remote repositories.

Sourcetree should tell us exactly what is needed to connect to Github and accept, e.g., the personal tokens in a secure way.

In particular it is not acceptable to store the personal token as a password in the connection (which, rightly so, Sourcetree warns us against).

I understand that the Github people have botched this for the Sourcetree users, but please fix it.

All the best

Marco Antoniotti

Like ā€¢ Paul Clarke likes this
jakub February 13, 2023

Gutgemacht

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events