38

A similar issue is described here however, my symptoms are a little different and none of the steps there seemed to work. Nor does the suggestion here work.

I'm attempting to use SourceTree to clone a private repo belonging to github organization of which I am a part. I have full permissions to view and commit to the repo, I can see it online when I log in, AND I can clone just fine with the command line and also via the github desktop application. It only fails in SourceTree.

Further, it is not bad credentials or anything like that, because I can clone, commit and push to my other non-private repos on github using SourceTree with my github credentials.

From the "Clone a Repository" dialog I enter the source URL, which looks something like this:

https://github.com/MyOrgName/reponame.git

I tab off of that field and it populates the destination path and name fields, but at the bottom of the dialog is a yellow exclamation point with this error:

This is not a valid source path / URL

If I click the error message, it brings up the "Details" dialog, which states the following (twice for some reason):

remote: Repository not found.
fatal: repository 'https://github.com/MyOrgName/reponame.git/' not found
remote: Repository not found.
fatal: repository 'https://github.com/MyOrgName/reponame.git/' not found

I have also tried this by adding my username to the url like so:

https://myusername@github.com/MyOrgName/reponame.git

but no luck there either.

spacemanjosh
  • 641
  • 1
  • 5
  • 14
  • Answer is here : https://stackoverflow.com/questions/20718193/issue-with-sourcetree-while-cloning-a-github-repository/20727233#20727233 – rbinsztock Aug 06 '18 at 15:08
  • Possible duplicate of [Issue with SourceTree while cloning a GitHub repository](https://stackoverflow.com/questions/20718193/issue-with-sourcetree-while-cloning-a-github-repository) – rbinsztock Aug 06 '18 at 15:08
  • I am having the exact same issue. Did you ever found a solution for that? – Pointi Sep 09 '18 at 13:16
  • I have had this issue multiple times with SourceTree, and I've finally moved on and stopped using it. The top answer here does not work, either due to my use of Windows or a more recent version, not sure. ST is a hindrance to the GIT workflow, not a help, and I've had enough of it. I've started using GIT integrated in to my IDE (VS2019) simply because it works reliably and ST does not. It's a shame to dump ST as its UI is better, but it's wasted far too much of my time with its numerous issues. – Rory McCrossan Jul 13 '21 at 15:19
  • you must give application permission on github https://stackoverflow.com/questions/40641849/gitkraken-is-not-showing-repo-i-am-a-contributer-to – sawacrow Sep 25 '22 at 22:06

4 Answers4

92

It happens because Sourcetree didn't get some private access from Github while authenticating. So the solution is very simple.

  1. Login to your Github account on any browser.

  2. From the top right corner select SETTINGS.

  3. Now select DEVELOPER SETTINGS.

  4. From DEVELOPER SETTINGS select PERSONAL ACCESS TOKEN.

  5. Now from PERSONAL ACCESS TOKEN select GENERATE TOKEN.

  6. Fill Note as Sourcetree and Check All Scopes from the checkbox as shown in the below screenshots.

  7. After Click on Generate Token.enter image description here

  8. Now Open Sourcetree.

  9. Click on Options in Tools menu & Click add Account.

  10. Select options as shown below screenshot.enter image description here

  11. Enter username as your Github account username and password as Generated Token from Github.

  12. Click on SAVE now you might see all your repository are visible and can clone too.

Hope it helps.

Ramesh R
  • 7,009
  • 4
  • 25
  • 38
Suresh Maidaragi
  • 2,173
  • 18
  • 25
5

I had same problem. My fix way:

  1. Remove user from SourceTree settings (optional, i not sure);

  2. Add you account in setting and generate new SSH key (it's a main part of fix);

  3. Clone your repo;

  4. If SourceTree sill can't clone repo you can try to clone from main page of SourceTree choosing external repos.

Claus Stolz
  • 358
  • 4
  • 18
  • Thanks for the suggestion, but it didn't seem to work in my case. For now, I'm using the GitHub desktop application to clone for this one case. – spacemanjosh Jun 10 '18 at 21:14
  • 1
    Go to Tools > Options > Authentication > Accounts > Set account as Default. In my case Ive multiple accounts. I only need my personal account at most times. By updating it fixed the issue for me – vyeluri5 Sep 05 '18 at 01:17
1

I managed to solve this by adding the remote private repo by cloning with SSH

Mario
  • 31
  • 2
0

I ran into this problem when trying to setup SourceTree on a new Mac computer and I frustratingly spent a whole day trying to figure out what was wrong.

I could connect to my Github account from the account page in SourceTree, I was also authenticated if I tried ssh -T git@github.com, but every time I tried to clone a repo from SourceTree I got the error: This is not a valid source path / URL.

Also, every time SourceTree tried to refresh the remote repositories I got the error: The operation couldn’t be completed. (com.google.GTMOAuth2 error - 1001.), and then it prompted me to sign in again, ending up in a loop.

What eventually worked for me was changing the SourceTree configuration from using embedded git to using system git.

This might not be the solution for everyone, but it worked for me.

You find the option in Settings -> Git -> Git version (press the button labeled Use System Git).

Hypo
  • 86
  • 3