用于 Git 的 Visual Studio 2013 工具未连接到私有 Github 存储库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19974282/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Visual Studio 2013 tools for Git not connecting to private Github repository
提问by Attila Szasz
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:
我正在尝试设置 Visual Studio 2013 以使用 Github 上的私有存储库。当我尝试克隆它时,或者如果我使用 Github for Windows 进行克隆并尝试从 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).
发生错误。详细消息:libgit2 引发错误。类别 = 净值(错误)。响应状态代码不表示成功:404(未找到)。
It works correctly with public repositories, but not with a private one. It also works from the Github for windows client.
它适用于公共存储库,但不适用于私有存储库。它也适用于 Windows 客户端的 Github。
采纳答案by Attila Szasz
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.
在@EdwardThomson 的帮助下,我发现 Visual Studio Git 工具正在将凭据保存到 Windows 中的凭据管理器。
问题是它没有将它保存在我正在寻找它的 Web Credentials 类别中,而是在 Windows Credentials 中,在 Generic Credentials 组中。
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:[email protected]/your_repo_name.
你可以解决这个问题,如果你使用这样的 repo url:https://username:[email protected]/your_repo_name。
回答by pash
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.
我通过删除 GitHub 保存在本地计算机中的凭据来修复它。
Here are the steps I took:
以下是我采取的步骤:
- Go to control panel
- Top right : Search "Credentials" ==> select "Credential Manager"
- Under Generic credentials ==> You should see GitHub ==> click on arrow
- Click on "Remove from vault"
- Try to commit and sync again
- 进入控制面板
- 右上角:搜索“凭据”==> 选择“凭据管理器”
- 在通用凭据 ==> 您应该看到 GitHub ==> 单击箭头
- 点击“从保险库中移除”
- 尝试再次提交和同步
回答by Siva
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.
默认情况下,windows 将密码存储在密码库中,通过使用凭据管理器,我们可以更新 web 和 windows 应用程序保存的密码的密码。
Open Credentials Manager > Locate Github account either on windows account or web account and update password.
打开凭据管理器 > 在 Windows 帐户或 Web 帐户上找到 Github 帐户并更新密码。
By deleting github details by above steps Visual studio will prompt password when clone or push.
通过上述步骤删除github详细信息,Visual Studio在克隆或推送时会提示密码。
回答by dortique
Insufficient privileges on the git-project (i.e. only read) will also give you this error.
git-project 权限不足(即只读)也会给你这个错误。
回答by Eric Ouellet
I add a similar problem and I just want to add some more information...
我添加了一个类似的问题,我只想添加更多信息...
atika answer is exact, you should use https://username:[email protected]/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.
atika 答案是准确的,您应该使用https://username:[email protected]/your_repository_name。如果你做了一些修改后需要更改存储库的url,那么你可以直接修改文件:"yourProjectRoot/.git/config"-propery:"url"。在对我的 git 配置文件进行修改之前,我关闭了我的解决方案。
But I suggest to use userName:password to git url on your initial "Clone". It will then be set properly for any other actions.
但我建议使用 userName:password 在初始“克隆”上 git url。然后它将为任何其他操作正确设置。
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).
此外,我个人还有另一个问题。我从主存储库克隆而不是我自己的分支。然后我无法“推送”(总是出现错误 403)。在我从 master 分叉之后(从 github web 界面使用分叉)然后一切顺利(我的用户:密码进入存储库 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.
我认为没有必要,但我建议在执行任何其他操作之前将您的详细信息指定到“团队资源管理器”视图 - “主页” - “设置” - “Git 设置”中。
Hope it help.
希望有帮助。
I was using embedded Git that come with Visual Studio 2013.
我使用的是 Visual Studio 2013 附带的嵌入式 Git。
回答by user1400290
Following link can help: an-error-was-raised-by-libgit2-category-net-error.html
以下链接可以提供帮助: an-error-was-raised-by-libgit2-category-net-error.html
回答by Aaron
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.
我在 VS 2013 中也遇到过这种情况。我通过删除项目并从 VS 中重新克隆它来解决它。不过很奇怪,它只发生在我正在使用的多个私有存储库之一上。
回答by Morné
Try checking if you have a proxy set on Internet Explorer. This fixed the issue for me.
尝试检查您是否在 Internet Explorer 上设置了代理。这为我解决了这个问题。
回答by Aamir
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.
我不会建议其他人这样做。但幸运的是,我处于开发的早期阶段。因此我不得不删除 Github 站点上的存储库。在我尝试恢复其中一项更改后,问题开始了。Github 与其说是实用程序,不如说是一种拖累。在我的组织中,我是一名孤独的开发人员,处理这些问题对我来说毫无意义。简单的本地 Git 应该已经足够了。