Pavel Pavlov
Pavel Pavlov

Reputation: 767

Issue with SourceTree while cloning a GitHub repository

I know that similar questions have already been posted here. However, I think my scenario is a bit different. Here is what I have.

I downloaded and installed the latest official version of the SourceTree software. Also, I have a GitHub account with permissions to clone and push the repository. In order to manage a local copy, I need to clone the online version. Here are the steps that I take:

  1. Start the SourceTree and navigate to File -> Clone / New ...

  2. In the opened window I paste the HTTPS clone URL. I copied it from the browser after I logged in to my GitHub account so the link is correct.

  3. The nest step is to specify a local folder where the repository will be copied. However, when I click to enter Destination Path, the window shows an error:

    This is not a valid source path / URL
    

    Clicking the error may give the following details:

    remote: Repository not found.
    fatal: repository 'https://github.com/org/repo.git/' not found
    remote: Repository not found.
    fatal: repository 'https://github.com/org/repo.git/' not found
    

    Or the details may be empty. SourceTree does not tell me the reason for the error or anything else.

I tried to re-install SourceTree but the error still exists. I asked the Administration of the GitHub repository for any other permissions but my account has all of them. I am able to push changes to the online repository using the Terminal console but I would like to use a UI (that SourceTree provides) to manage and compare changes in the code.

One think I did not try is to clone the repository using another GtHub account. However, I don't want to do that because I need to commit any changes to the repository on my behalf.

Does anybody know how can this error be fixed or worked around?

Upvotes: 46

Views: 192660

Answers (29)

Dean P
Dean P

Reputation: 2225

This mostly happens when you don't add a personal access token to your remote repo URL. Instead of adding the following repote repo URL like so: https://github.com/OWNER/PROJECT.git You should add your token infront of your remote URL like so: https://[email protected]/OWNER/PROJECT.git

where TOKEN is your personal access token.

Dont have a personal access token? To generate one using Github as an example (Other remote repo's will have similar steps) go to settings/developer settings/personal access tokens/generate new token.

Upvotes: 2

Robert Michels
Robert Michels

Reputation: 41

I had the same issue and had no luck with the solutions mentioned here, including using system Git and using Personal Access Tokens. What was odd too, is that I could clone some of my personal repositories, but not the one I needed for work. However, I was able to access that repository with the same ID and overall setup on another device. Finally, I noticed this text on the repository clone pop-up on GitHub: Use a password-protected SSH key. That's all it was: I rushed through setting up git and SSH on my new device and figured why not try using no passphrase for my SSH key this time. Turns out that besides the security implications, it was also a bad idea because it caused this issue for me.

Steps to resolve:

  1. Remove SSH key (if this is the only one you had, and you're on Mac, rm -rf ~/.ssh/* will clear all SSH keys by deleting the contents of the .ssh folder - taken from this answer)
  2. Sourcetree -> Preferences -> Accounts -> Select Account, Edit -> SSH Key: Generate Key
  3. Create SSH key, make sure to enter a Passphrase in this step
  4. Copy the public key to Clipboard, add to GitHub
  5. Try to clone the repository again, you might have to reopen Sourcetree and enter the passphrase. At this point I no longer got the This is not a valid source path / URL error.

Upvotes: 3

sam
sam

Reputation: 4397

I had the same issue that wasn't solved by current answers. In my case it was a changed password issue, what I did was:

  • Close sourcetree
  • Remove the passwd file under: C:\Users[username]\AppData\Local\Atlassian\SourceTree
  • Reopen sourcetree
  • It will ask for your password again, login and it worked

Upvotes: 0

marika.daboja
marika.daboja

Reputation: 991

I have had same issue and to make it worst when I deleted Account from the SourceTree (SourceTree -> Preferences -> Advanced -> Remove), my SourceTree was not prompting me to Authenticate anymore. It did not allow me to login in - instead just displayed an error 'This is not a valid source path / URL'.

I resolved it by clearing my .gitconfig file. Open Terminal and navigate to root directory, open .gitconfig, delete content and save it.

Then copy repo URL (Try copy it from the actual URL scope) and paste in SourceTree. At this point Sourcetree should present an Authentication pop up window to allow you type your credentials again.

Once you Authenticate successfully, new content of the .gitconfig will be automatically generated.

Upvotes: 0

iAnurag
iAnurag

Reputation: 9356

In my case the URL generated from SourceTree was wrong. Somehow my organisation's name was appended at the start of URL. I copied the repo link directly from github. It resolved my issue.

Upvotes: 0

I removed and added my account again using the HTTPS rather than SSH URL.

Upvotes: 1

Adil Hussain
Adil Hussain

Reputation: 32093

In my case I had used SourceTree's "Add account" setting to add my Bitbucket and GitHub accounts to SourceTree under the SSH protocol. SourceTree did everything correctly to generate SSH keys and add them to my machine but it made a slight mess of the entries that it added to my ~/.ssh/config file. It created entries as follows:

Host username-Bitbucket
  HostName bitbucket.org
  User username
  PreferredAuthentications publickey
  IdentityFile /Users/adil/.ssh/username-Bitbucket
  UseKeychain yes
  AddKeysToAgent yes

Host username-GitHub
  HostName github.com
  User username
  PreferredAuthentications publickey
  IdentityFile /Users/adil/.ssh/username-GitHub
  UseKeychain yes
  AddKeysToAgent yes

The Host values it generated are incorrect. I changed the entries in my ~/.ssh/config file to the following:

Host bitbucket.org
  User username
  PreferredAuthentications publickey
  IdentityFile /Users/adil/.ssh/username-Bitbucket
  UseKeychain yes
  AddKeysToAgent yes

Host github.com
  User username
  PreferredAuthentications publickey
  IdentityFile /Users/adil/.ssh/username-GitHub
  UseKeychain yes
  AddKeysToAgent yes

After making this change, the "This is not a valid source path / URL" error went away and I was able to clone repositories from my Bitbucket and GitHub accounts without problem.

Upvotes: 1

Matthias Tosch
Matthias Tosch

Reputation: 25

In my specific case (setting up a new mac) the root cause was a "missing xcrun" meaning the local dev tools wasn't activated, and the local git client can't run properly.

that was my fix

xcode-select --install

Upvotes: 0

Samet ÖZTOPRAK
Samet ÖZTOPRAK

Reputation: 3346

probably you try the wrong account only add this account.name@ to link

you can learn it from your GitLab account

https://[email protected]/samrak-growth/samrak-app-backend.git

Upvotes: 0

s.m.
s.m.

Reputation: 8043

I'm posting another possible solution, as I just helped a colleague who couldn't clone a private repo belonging to a GitHub organization even though he had been given the correct level of access.

Check the Windows Credential Manager, especially if you've been using the same machine for some time or have connected to different accounts.

Git may be picking up the wrong credentials without you realizing it, and that's why it can't find the repo.

To be on the safe side, delete all the credentials that have to do with git/github. You'll know you have done it properly and are starting from a fresh state when you will try cloning again and git will ask you to authorize it through your browser.

Upvotes: 1

Arshad Shaik
Arshad Shaik

Reputation: 1254

In my case i was doing new Mac book setup.

Without installing Xcode i was trying to clone branch using SourceTree.

After Xcode installation done, branch cloned successfully.

SourceTree asked for system password for cloning.

Upvotes: 0

Shashidhar Yamsani
Shashidhar Yamsani

Reputation: 573

I was trying to clone a project from gitlab. However, I have cloned gitlab projects earlier with an account/user credentials which is different from the new account I want to use. In this case, I had deleted the credentials for the old account and then I was able to clone the project by entering credentials for the new gitlab account. To delete the account on MAC go to Preferences > Advanced > Select the account to remove > Click remove.

Upvotes: 0

Pavel Kovalev
Pavel Kovalev

Reputation: 8116

So I'm here in 2021. Previous answers didn't work for me. There is an issue with a SourceTree (to be honest a lot of issues actually) and as a workaround you can use a token as a password to connect to GitHub.

Use this url to create it: https://github.com/settings/tokens I hope it helps! 🙂

Upvotes: 8

Kajal Choudhary
Kajal Choudhary

Reputation: 51

I was facing the same issue in mac. The following solution worked for me :

  1. Generate personal access token in Github using the following steps : Login to Github account -> Settings -> Developer Settings -> Personal access tokens -> Generate new token -> Enter token name -> Generate token
  2. Sourcetree > Preferences > Advanced
  3. Remove the Host name
  4. Clone the project again in Sourcetree
  5. A prompt will pop up; enter your git credentials. (enter username and in password enter newly generated access token) After following this steps, Clone option will get enabled

Upvotes: 5

Narendra Chandratre
Narendra Chandratre

Reputation: 921

I face this issue on Windows 11 and following are the steps worked for me :

  • Click on Open with GitHub Desktop option [Refer below image] enter image description here
  • Download & install
  • Launch and click on Open in browser with Github.com
  • Enter your credentials & validate
  • Now, Open SourceTree
  • Click on Tools > Options > Authentication
  • You will see your Git credentials were successfully added in SourceTree & you can proceed with any option like clone repo etc

Upvotes: 0

Vishal Saini
Vishal Saini

Reputation: 11

Install git to your system by browser and then go to the source tree, click on Tools -> Options -> Git then scroll down and click on system. It works for me, I hope for you too.

Upvotes: 1

MrHIDEn
MrHIDEn

Reputation: 1879

Lastly on Mac I went to

Sourcetree->Preferences->Git->Git version->Use System Git

and it works... puf!

Upvotes: 59

Abhay Singh
Abhay Singh

Reputation: 171

If you are using Mac and there is Keychain access handling all your authentication, then delete the entry for stash/git url. Now try to checkout in sourcetree and it will ask to enter the password again.

That will solve your problem.

Upvotes: 0

Vikash Sinha
Vikash Sinha

Reputation: 877

I was facing the same issue in Sourcetree for macOS:

This is not a valid source path / URL

This is not a valid source path / URL

The following solution worked for me:

  1. Sourcetree > Preferences > Advanced
  2. Remove the Host name
  3. Clone the project again in Sourcetree
  4. A prompt will pop up; enter your git credentials.

That's it, it resolved my issue.

Upvotes: 44

vinay shetty
vinay shetty

Reputation: 981

options -->Tools--->disable ssh worked for me in Mac

Upvotes: 0

Shawn DeWolfe
Shawn DeWolfe

Reputation: 111

I had the same problem. My resolution was to commit an initial file into the repo. After that, I could clone the repo to my desktop.

Upvotes: 0

Peter Meadley
Peter Meadley

Reputation: 509

Just in case someone who has multiple git accounts connected and faces this issue, I solved it by going to Tools > Options > Authentication and marking the account which has access to the repo you are trying to clone as default.

Upvotes: 1

Eran Goldin
Eran Goldin

Reputation: 979

Adding my scenario and solution:

I have two factor authentication turned on. I couldn't see some private repositories, and couldn't clone from URL. The error I saw was:

remote: Repository not found.
fatal: repository 'https://github.com/bizzabo/web-common.git/' not found
remote: Repository not found.
fatal: repository 'https://github.com/bizzabo/web-common.git/' not found

Supposedly newer versions of SourceTree don't need a personal access token because they can authenticate directly with github, but I couldn't get this to work.

Apparently OAuth and 2FA don't mix well together -- so I changed the authentication method from oauth to basic and used the access token I generated. That did it.

Upvotes: 1

Self Service Portal
Self Service Portal

Reputation: 47

Even tried all the options above, It quite dint work for me.

  • I disable the option of ssl certificate

steps :

Go to Tools -> Options -> Git. check the box of "Disable SSL certificate validation"

It worked for me.

Upvotes: 3

gp7
gp7

Reputation: 1

I had also same issue This is not a valid source path / URL and it got resolved by updating the Embedded Git of Source Tree.

This issue also manifested itself where I couldn't push or pull from previously cloned and working repositories in source tree. I complained about authentication username and password but clearly that was not the case.

Steps to resolve: Open source tree, Tools -> Options -> Click on Git Tab -> Update Embedded Git.

Upvotes: 0

SANDIP
SANDIP

Reputation: 89

I was facing the same issue with windows 10 and source tree. After bit research following solution worked for me. I needed to download or enable the git support in source tree.

Steps 1) Go to Tools -> Options -> Git -> Enable git support

That's it it resolved my issue. Happy coding :)

Upvotes: 5

Fehr
Fehr

Reputation: 534

May I also just add that I resolved this issue by installing Git through SourceTree from [SourceTree]>Tools>Options>Git.

As I'd been using mercurial exclusively on that system till then it had never been installed, and so was presenting the above described error when trying to clone.

Hopefully this helps someone with the same issue! If not, good luck!

Upvotes: 1

Naveed Ghori
Naveed Ghori

Reputation: 49

I had to uninstall and reinstall SourceTree before it would work. I think my antivirus (Comodo ) was blocking/sandboxing some stuff on the initial install so I disabled it for the reinstall.

Upvotes: 0

VonC
VonC

Reputation: 1323115

The exact error message is (as illustrated here):

 This is not a valid source path / URL

error message in sourcetree

Possible cause:

  • proxy settings (as in this thread)
  • setup steps, with Git disabled (as in here)

    When SourceTree started for the first time, I skipped setting up Git & Mercurial in the wizard. Then I reran the wizard and chose to download and install the embedded packages.
    But it seems installing those didn't actually enable them - in the Tools -> Options dialogue they were both disabled!
    Enabling Mercurial (or Git in your case) allowed the clone dialogue to correctly identify the repo.

  • credential issues (as in here, from my old answwer)

Upvotes: 20

Related Questions