3

I am trying for the first time to download a Git repository to Visual Studio 2019 using VS Clone. I am getting

Cloning into 'C:\Users\Charles\Source\Repos\FingerprintGuide'...
Error encountered while cloning the remote repository: Git failed with a fatal error.
repository 'https://github.com/xamarin/monodroid-samples/tree/master/FingerprintGuide/' not found

The folder certainly exists as anyone can verify. I am signed into Git from a Web browser outside of Visual Studio. Visual Studio Git Options has my correct Git user name and e-mail.

What might I be doing wrong? As I say, I am new to Git, so it might be something obvious.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Charles
  • 479
  • 1
  • 3
  • 13
  • 2
    You can have a look at similar issue : https://stackoverflow.com/questions/42667928/visual-studio-2017-git-failed-with-a-fatal-error – Mohit kumar Jul 17 '21 at 21:40
  • Thanks. I tried the 5-step program detailed there. Still getting same error. – Charles Jul 17 '21 at 22:06
  • My gosh. There are about fifty different "try this/try that/delete OpenSSL" ideas there. What is a poor user supposed to do? – Charles Jul 17 '21 at 22:11
  • 1
    I think that's because you have a bad url that should only be `https://github.com/xamarin/monodroid-samples` – Philippe Jul 18 '21 at 07:17
  • Thank you, yes, that did it. Although I now have almost a gigabyte more of stuff than I actually wanted. – Charles Jul 18 '21 at 14:33
  • 1
    For that, you should do a shallow clone or a partial clone (or both) depending on what you want to achieve : https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/ – Philippe Jul 18 '21 at 20:52
  • Thanks, yeah, I really need to learn git. – Charles Jul 18 '21 at 22:51
  • What is *"VS Clone"*? A menu command? Is it literal? Or really a common noun? Something else? – Peter Mortensen Mar 14 '22 at 01:09
  • Today I came across this very same issue while trying to clone a Git repo. If anyone managed to fix this please reply. – Sujit Prabhakaran Jun 12 '23 at 16:43

3 Answers3

3

You have to customize some setting in Visual Studio to clone properly.

  1. Continue without code in the start page of Visual Studio

  2. Go to the Git menu in Visual Studio

  3. Go to Settings

  4. Search for source control in the left tree view

  5. Select Git Global Settings

  6. Then set the setting as shown:

    Git settings for Visual Studio

And then try to clone again. Before cloning, delete the destination or make the destination folder empty in your local machine to which you are cloning into.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Rashedul.Rubel
  • 3,446
  • 25
  • 36
1

Remove all azure, git, github, VisualStudio, vs code "windows credential".

Watch this video : https://www.youtube.com/watch?v=Y6qLNgFt1EM

M Komaei
  • 7,006
  • 2
  • 28
  • 34
1

Clear credentials solve my problem, thanks for Kayla Ngan who proposed the solution

In the Windows search, type "Credential Manager". Choose "Windows Credentials", then clear the creds for the specific "git:{URL}". Then try cloning again.

ref: https://developercommunity.visualstudio.com/t/git-failed-with-a-fatal-error-repostiory-not-found/156101#T-N179991