Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Sourcetree doesn't list GitHub private repos by default

Jingran Wang December 27, 2018

My GitHub account has both public and private repos, but only the public ones are listed in the New Tab -> Remote view. I can search and find my own private repos, but I can't list any repos (public or private) that I have access to, i.e. listed in the API call to https://api.github.com/user/repos. This also affects private repos in organizations I'm in, despite the "Show Organization Repos" checkbox. I am not a member of any organizations that have public repos, so I can't check that.

 

This isn't a deal breaker, because I can still use the Clone button, but the "Cloning is even easier if you set up a remote account" text is taunting me.

4 answers

39 votes
Tim Morris
Contributor
June 23, 2019

I had a similar problem; after adding my GitHub account to SourceTree, repos belonging to my organization weren't appearing in the 'Remote repositories' list. I tried starring the relevant one, but that didn't make a difference. 

I discovered it was an issue with the default permissions in the OAuth settings; by default, it doesn't give organization access. 

To fix, go to your GitHub settings -> Applications -> Authorized OAuth Apps -> Sourcetree ('SourcetreeForWindows' in my case): you can see the list of permissions granted, and underneath that Organization access, and the option to turn it on.

[This Medium article described the same problem and solution, except that they suggest deleting and re-creating the OAuth token, whereas I was able to just edit the settings on mine: https://medium.com/@johnnyfekete/accessing-a-git-repo-after-transferring-it-to-an-organization-99b1c78f5286 ]

(I'm not sure if is the same/similar problem to above, but I came across this question when searching for a solution, so thought it good to add my solution here after I worked out what my issue was.)

youssef elhefnawy
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 12, 2019

Thanks that solved it for me :)

Like # people like this
stevenvachon
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 27, 2019

There is no "Organization access" within my "SourcetreeForMac".

Like # people like this
Anthony Webb
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 8, 2020

I am seeing the same as @stevenvachon in fact, when the oauth happens it only asks for basic public data so I don't see how Sourcetree would ever be able to actually see any private repos?

 

Screen Shot 2020-01-08 at 12.43.06 PM.png

Tim Morris
Contributor
January 9, 2020

I'm afraid it's a while since I did this, so I forget the details. But certainly the repos I was concerned with were public ones, just that they belonged to an organization. So the commonality of my problem with the original question here was "organization repos not appearing" rather than the private/public dimension of the question. So it could well be that the solution for that is different.

However, I'd be surprised if it's not possible to access private repos at all this way. You may well have already looked here, but I found this on an initial google: 
https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/about-oauth-app-access-restrictions
https://developer.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/ 

Is it just a private repo you're wanting to access, or a private organization repo? If the latter, from that first link I think an organization owner has to grant access for the app (so I guess even if you have access as a GitHub user, you don't automatically get access when using the app).

That may or may not be helpful, but I hope you can find a solution. And do post back here when you do!

Like Valeriu Tihai likes this
dn21
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 13, 2020

I didn't see the "organization access" under the list of applications either, but then I read a comment on the linked blog from the OP. It says you have to click the name of the application as well, then organization access will be at the bottom of the next page.

Lloyd Jones
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 22, 2020

I don't see the option to allow organization access. This is all I get:

Screenshot 2020-07-22 at 15.07.58.png

So right now, SourceTree can only see my private (personal) repos, not my private (organizational) ones..

Lloyd Jones
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 22, 2020

UPDATE:

This solves it for me.

Like # people like this
Nikishin Iliya
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 3, 2020

also saved me an hours! thank you @Tim Morris 🤝

Like # people like this
floris83
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 24, 2022

Worked for me too, awesome!

3 votes
Boris Perović
Contributor
December 28, 2018

The problem you are encountering sounds similar to the one I had. Take a look here for a workaround: https://community.atlassian.com/t5/Sourcetree-questions/Re-Sourcetree-for-Mac-GitHub-account-permissions/qaq-p/970146/comment-id/26875#M26875

Additionally, it might be helpful to upvote the issue here: https://jira.atlassian.com/browse/SRCTREE-6322

Cheers

Jingran Wang December 28, 2018

Thanks Boris, that helped a bit, but the workaround only gave me access to public repos of organizations I'm in, and didn't help with private repos of said organizations, nor my own private repos. I've upvoted the Mac issue, but I'll add an additional issue for Windows, since it seems that the functionality might be different, e.g. the initial OAuth request on Windows does request quite a lot of permissions.Kr2ICuD

Mahesh
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 15, 2019

Facing similar issue. 

We have a private GIT repo server (other than GitHub) and unable to use SourceTree to clone my repo from there.

Any pointers to documentation around same would be helpful 

Like skanunnikov likes this
0 votes
Deleted user September 25, 2022
0 votes
Chest Rockwell
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 28, 2022

Solved for me: https://community.atlassian.com/t5/Sourcetree-questions/Sourcetree-for-Mac-GitHub-account-permissions/qaq-p/961120 

Short summary:

  1. Remove "Github Credentials SourceTree (OAuth) for GitHub" from Keychain Access
  2. Restart Sourcetree
  3. Click "Remote" tab
  4. Observe "Refreshing Remote Repositories Failed" dialog

...you will then be prompted to login and allow all the permissions that Sourcetree needs.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events