When adding a GitHub account to Sourcetree for Mac 3.0.1 (205), using OAuth and HTTPS, only public read permissions are requested:
Consequently, no private repos are accessible and no write permissions are given. I found no way of elevating the requested permissions either through Sourcetree or through GitHub settings.
I found a workaround by accident: after the Sourcetree app is authorized, an entry is created in Keychain Access:
Github Credentials
Kind: application password
Where: SourceTree (OAuth) for GitHub
Deleting this entry, relaunching Sourcetree and clicking on "Remote" tab gives this info:
After clicking on "Sign In", GitHub finally presents the additional permissions prompt:
Shouldn't Sourcetree ask for all of these permissions when adding the account using the normal workflow?
Thank you.
Still when using the workaround I proposed, I am unable to access private repos of some organizations I am a part of, rather I need to request access individually for SourcetreeForMac from here https://github.com/settings/applications like this:
Searching around, I found another workaround, which finally gave me the full access:
1) Go to https://github.com/settings/tokens
2) Click "Generate new token"
3) Input token description e.g. "Sourcetree Mac Token", select "repo" checkbox, and click "Generate token"
4) Copy the generated token
5) Add your GitHub account to Sourcetree, but now rather than using OAuth, select Basic authentication
6) Input your username
7) Paste the generated token as password
Now you should have a fully functional connection between your GitHub account and Sourcetree, including access to all private repos. If you encounter any functionality that is not working (I haven't), try regenerating the token with more permissions - I intentionally selected only "repo", as that is all I need at this moment.
Hope this is helpful, until there is a fix from Sourcetree team. As mentioned above, the issue has already been filed here https://jira.atlassian.com/browse/SRCTREE-6322
Cheers
For Windows, you need to also select the "user" checkbox while generating the token, otherwise it won't work. (for anyone that finds this from searching Google)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you, your workaround fixed my issue. Still cannot believe this still persists in May 2020.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Worked for me, too. Mostly straightforward (in retrospect), only gotcha really is pasting the generated token into "Password" field. They probably should rename it to "Token" or something.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this worked like a charm, many thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Solved, thanks Boris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Worked for me—thanks @Boris Perović! 🎉
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This workaround helped!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks!!! you saved me!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks a lot it works :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks a lot!!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Boris Perović
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Still happening December 2021! Thanks! @Boris Perović
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
February 2022....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks a lot @Boris Perović still working
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Boris Perović Thanks. This worked like magic.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Boris Perović thank you so much, 14 march and it helped me :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This was a huge help--thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you!!! Beens searching for days. This was the ONLY solution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It worked, thank you!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks much! So frustrating (though I suppose par for the course for an Atlassian product). Still useful as of SourcetreeForMac 4.1.8.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks you! It is still working well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this is not working for me
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It worked for me, thanks so much Boris!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this one worked for me as well. Cheers mate!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks a lot Boris, I can't believe OAuth isn't fixed yet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This worked for me without hacks.
1. Choose Basic auth
2. Input github username.
3. Choose SSH protocol (should be default) and then click on "Generate key"
4. In your github. Settings > SSH and GPG keys > New SSH Key - paste generated key.
5. Then Settings > Personal access tokens > Generate new token.
6. Add your self enough rights that you feel comfortable with and set proper expiration.
7. After generating PAT paste it in SourceTree in password field.
Voila now you have access to private repo and rights that you choose under PAT.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is still not solved right?
GitHub constantly informs me that Basic Authentication will soon no longer be available:
(Basic authentication using a password to the API is deprecated and will soon no longer work. Visit https://developer.github.com/changes/2020-02-14-deprecating-password-auth/ for more information around suggested workarounds and removal dates.)
Guess, its time to leave Sourcetree behind!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Wow, 3 years later and this stupid work-around is still needed.
Thank you Boris!! Worked exactly as you said. (Github with SSH.)
Shame on you Atlassian.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've painfully downloaded GitHub Desktop for macOS and use it to do my pushes to origin. I guess if I were a "real dev" I'd set up the command line instead, but didn't want to mess with setting up a PAT again and GitHub Desktop, though not quite as nice as SourceTree, does wisely ask for push permissions (and stores the results) on first login.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To Sourcetree staff:
Problem still exists - I imagine getting your competitor's repos to work easily with your software seems counter-intuitive, however this problem was just about to drive me to start using the Github application instead...soo.....
Food for thought.
To the OP:
Awesome!
THANK YOU for this post, this solved it for me on Mac.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Spent couple of hours figuring this out. Tried everything that I can find but unfortunately nothing works. Not unless I found this, thank you! This works perfectly for my case!
Cheers!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was so disappointed because until now I can't find solution to this. Sourcetree has no support yet for private data viewing or to access it from Github. Only Public Data is viewable. Please any help thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Read the part about the workaround in the first post, and try that
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This works properly in the Windows version of SourceTree but (still, one year later) is not fixed in the Mac version as of 4.0.232. There were a handful of other bugs in the authorization dialog too (such as, can't switch from Basic to OAuth on an existing account). Anyone driving this bus?
The workaround at the top with deleting the keychain entry does work, so some part of the SourceTree code has the right implementation for requesting permissions. So the response from the Atlassian Team member to the effect of "we do this on purpose" can be ignored.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Boris,
Thank you so much for the solution. This worked for my organizations private repo. Strangely, none of my colleagues faced the issue except me. We have 2FA enabled and only for me it was causing issue.
Just to mention, am in Mojave while all my colleagues are still in High Sierra but don't think this should be an issue.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Boris,
First of all thanks for the workaround. I was able to access my private repositories with your approach.
I think this problem is bigger than it seems, because if you're new to GitHub (or any other alternatives) and SourceTree, you may end up losing your access to your private repositories. The reasons why so many people are not facing this problem are either this problem is something new (maybe related with 3.0.1) or they have already given the permission to SourceTree for full access. I was revoking my Oauth App tokens and when I re-connect my GitHub account with SourceTree, I face this one.
Hope you guys figure this out soon.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Boris,
Sourcetree's OAuth permissions for all services (not just GitHub) are intentionally narrowly scoped. We don't want authorization for actions we aren't using in the app. The request for private repos is a good one and should be filed in our public trackers (Mac and Windows) Cheers!
Brian Ganninger
Senior Mac Developer, Sourcetree
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Brian,
Thank you for answering. I do appreciate the privacy-conscious approach that the Source Tree team is taking. Still, the basic set of public read permissions requested does not even allow for write access to public repos, so I am unable to push any changes. It seems that someone has already filed an issue regarding this behavior:
https://jira.atlassian.com/browse/SRCTREE-6322
Hope this gets sorted out soon.
Kind regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@bgannin Brian, eight months later, your team still has not fixed this issue that makes SourceTree unusable on Macs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's ridiculous. I can't access my private repository because of the "actions you are not using in the app"? It seems you like to make source tree unusable.
To continue like that it's better to stop developing it. You need to decide if you want to create a useful tool or some sort of a gimmick.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.