问题
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.
回答1:
I had same problem. My fix way:
Remove user from SourceTree settings (optional, i not sure);
Add you account in setting and generate new SSH key (it's a main part of fix);
Clone your repo;
If SourceTree sill can't clone repo you can try to clone from main page of SourceTree choosing external repos.
回答2:
I managed to solve this by adding the remote private repo by cloning with SSH
回答3:
It happens because SourceTree didn't get some private access from Github while authenticating. So the solution is very simple
- Login into your Github account on any browser
- From top right corner select SETTINGS
- Now select DEVELOPER SETTINGS
- From DEVELOPER SETTINGS select PERSONAL ACCESS TOKEN
- Now from PERSONAL ACCESS TOKEN select GENERATE TOKEN
Fill Note as
sourcetree
and Check All Scopes from checkbox as show in below screenshotsAfter Click on Generate Token
Now Open sourceTree
Click on sourceTree preference & Click add Account
- Select options as shown in below screen shot
- Enter username as your Github account username and password as Generated Token from Github
- Click on SAVE now you might see all your repository are visible and can clone too
Hope it helps
来源:https://stackoverflow.com/questions/50263836/cant-clone-private-repo-on-github-from-sourcetree