21

I'm trying to set up Visual Studio 2013 to work with a private repository on Github. I get the following error when I try to clone it, or if I clone with Github for Windows and try to push/pull from Visual Studio:

An error occurred. Detailed message: An error was raised by libgit2. Category = Net (Error). Response status code does not indicate success: 404 (Not Found).

It works correctly with public repositories, but not with a private one. It also works from the Github for windows client.

Attila Szasz
  • 3,033
  • 3
  • 25
  • 39
  • 1
    It may be an authentication failure. Github returns 404 (instead of 401/403) for auth failures to private repo's, because otherwise they would give away whether a private repo does or does not exist. – Barend Nov 14 '13 at 11:30
  • @barend can you cite that? That seems odd: How do you give credentials to something that returned a 404 instead of a 401? – Edward Thomson Nov 14 '13 at 12:46
  • I cannot find the reference, sorry. It was probably a post on their blog or maybe a recorded talk. The purpose is client confidentiality. If you have an existing user session, you can access the private repos via HTTP (for SSH access, it hinges on the client certificate). If you don't have a session, you need to go through the public pages to login; you don't get a 401. Now, I don't know the Visual Studio tools, so I don't know if this mechanism is the cause of the 404 you're getting or if something else is going on. – Barend Nov 14 '13 at 13:20
  • @Barend actually, for any non-public repo URL, it responds with a *401* to prevent information disclosure. If I go try to clone `https://github.com/ethomson/DoesNotExist`, I am prompted for authentication. – Edward Thomson Nov 14 '13 at 14:14
  • @atika are you prompted for username/password? are you using a credential helper? are you using `https` or `http`...? – Edward Thomson Nov 14 '13 at 14:14
  • Have you tried http://gitcredentialstore.codeplex.com/? – jessehouwing Nov 14 '13 at 21:15
  • Anyone able to provide access to a private account? I don't have one, but would like to fix it. – jessehouwing Nov 14 '13 at 21:16
  • @EdwardThomson Using https, does not prompt for credentials. – Attila Szasz Nov 15 '13 at 08:12
  • @jessehouwing Installed gitcredentialstore, git.exe is in the path, did not solve the problem. Still no access and no prompt for user/pass. – Attila Szasz Nov 15 '13 at 08:13
  • @jessehouwing: I have private repos, they work fine. Credential helpers aren't supported since we don't call core git. atika can provide a screenshot of the clone succeeding in core git and the way you're cloning in VS? You can send it to my Microsoft.com email if you prefer. – Edward Thomson Nov 15 '13 at 11:57
  • @EdwardThomson sent screenshots. – Attila Szasz Nov 18 '13 at 07:48

10 Answers10

20

With the help of @EdwardThomson I discovered that Visual Studio Git tools is saving credentials to Credential Manager in Windows.
The problem is that it doesn't save it in the Web Credentials category where I was looking for it, but in the Windows Credentials, down in the Generic Credentials group.

This causes problems if you are using multiple private repos with different credentials because you are not prompted again.

You can work around this, if you use the repo url like this: https://username:password@github.com/your_repo_name.

Attila Szasz
  • 3,033
  • 3
  • 25
  • 39
16

I had the same problem. I had logged in with personal credentials, now I was trying on my office credentials.

I fixed it by removing the credentials GitHub saves in your local machine.

Here are the steps I took:

  1. Go to control panel
  2. Top right : Search "Credentials" ==> select "Credential Manager"
  3. Under Generic credentials ==> You should see GitHub ==> click on arrow
  4. Click on "Remove from vault"
  5. Try to commit and sync again
pash
  • 161
  • 1
  • 2
7

This one worked for me if switching users/multiple repositories with different credentials.

By default windows stores the passwords in passwords vault, by using credentials manager we can update the passwords of saved password of web and windows applications.

Open Credentials Manager > Locate Github account either on windows account or web account and update password.

By deleting github details by above steps Visual studio will prompt password when clone or push.

Siva
  • 128
  • 1
  • 3
3

I add a similar problem and I just want to add some more information...

atika answer is exact, you should use https://username:password@github.com/your_repository_name. If you need to change the url of the repository after you did some modification, then you can modify the file: "yourProjectRoot/.git/config" - propery: "url" directly. I closed my solution before I did that modification to my git config file.

But I suggest to use userName:password to git url on your initial "Clone". It will then be set properly for any other actions.

Also, I personally had another problem. I cloned from the master repository instead of my own fork of it. Then I was not able to "push" (always got error 403). After I forked from the master (Use fork from the github web interface) then everything was going smoothly (with my user:password into the repository url).

I don't think it is necessary but I recommend to specify your details into "Team Explorer" view - "Home" - "Settings" - "Git Setting" before doing anything else.

Hope it help.

I was using embedded Git that come with Visual Studio 2013.

Eric Ouellet
  • 10,996
  • 11
  • 84
  • 119
3

Insufficient privileges on the git-project (i.e. only read) will also give you this error.

dortique
  • 820
  • 8
  • 9
1

Following link can help: an-error-was-raised-by-libgit2-category-net-error.html

user1400290
  • 1,682
  • 5
  • 23
  • 43
0

I had this happen to me in VS 2013 as well. I solved it by removing the project and re-cloning it from within VS. It's strange though, it was only happening on one of the multiple private repos I'm working with.

Aaron
  • 282
  • 1
  • 4
  • 11
0

Try checking if you have a proxy set on Internet Explorer. This fixed the issue for me.

Morné
  • 69
  • 1
  • 9
0

I will not advise anyone else to do this. But luckily I was in the earlier stages of development. Therefore I had to delete the repository on Github site. The problem started after I tried to revert one of the changes. Github is more of a drag than a utility. I am a lone developer in my organization and doesn't make sense to me to be dealing with these problems. Simple local Git should have been enough.

Aamir
  • 791
  • 3
  • 15
  • 28
0

This happened to me when I changed the name of the repo from main to origin, then its not credentials, it's a setting that holds the path of the repo:

Visual Studio -> Team Explorer -> Settings -> Repository Settings in the section Remotes edit the path with the new value after _git/{newName}

William Baker Morrison
  • 1,642
  • 4
  • 21
  • 33