简体   繁体   English

Git:无法删除凭据:找不到元素

[英]Git: Failed to erase credential: Element not found

I'm trying to set up Git on a fresh machine, and I'm having trouble authenticating with my remote repository. 我正在尝试在新机器上安装Git,而我在使用远程存储库进行身份验证时遇到了问题。

I have limited experience with Git, but I have successfully done the following before: 我对Git的经验有限,但我之前成功完成了以下工作:

  • Create local repository ( $git init ) 创建本地存储库( $git init
  • Connect with remote repository ( $git remote add origin https://[my remote repository] ) 连接远程存储库( $git remote add origin https://[my remote repository]

Everything goes well up until this point. 到目前为止,一切顺利。 However, when I try to interact with the remote repository - pull, clone or push - either through command line or TortoiseGit, I am greeted with the following error message upon entering my credentials: 但是,当我尝试通过命令行或TortoiseGit与远程存储库(拉,克隆或推送)进行交互时,在输入我的凭据时,我会收到以下错误消息:

Failed to erase credential: Element not found 无法删除凭据:找不到元素

fatal: Authentication failed for https://[my remote repository] 致命: https:// [我的远程存储库]的身份验证失败

It obviously seems like some sort of authentication issue - however, I can log into the web interface of the remote repo just fine, so I'm certain I'm using the correct un/pw. 它显然似乎是某种身份验证问题 - 但是,我可以很好地登录远程仓库的Web界面,所以我确定我正在使用正确的un / pw。 I've installed the Windows Credential Store for Git, but that throws the exact same error message. 我已经为Git安装了Windows Credential Store,但是它会抛出完全相同的错误消息。

Google hasn't been much help - this solution seems to be Vista / 32bit specific (I'm Win7 / 64bit), and this SO question has been removed, leaving me none the wiser. 谷歌没有太多的帮助 - 这个解决方案似乎是Vista / 32bit特定的(我是Win7 / 64bit), 这个问题已被删除,让我没有更聪明。

Now, I'm sure there's a simple solution to my problem, but I've been at it all day with no progress. 现在,我确信我的问题有一个简单的解决方案,但我一整天都没有进展。 Anybody able to give me a pointer? 有人能指点我吗?

Thanks in advance! 提前致谢!

Edit: Here's the full results of a clone command: 编辑:这是clone命令的完整结果:

I:\\KODE\\_Git\\myproject>git clone https://... 我:\\ KODE \\ _Git \\ myproject> git clone https:// ...

Cloning into 'myproject'... 克隆到'myproject'......

Username for 'https://...': myuser “https:// ...”的用户名:myuser

Password for ' https://myuser[at] ...': ' https:// myuser [at] ...'的密码:

fatal: Authentication failed for 'https://...' 致命:“https:// ...”身份验证失败

I had the same error in windows. 我在Windows中遇到了同样的错误。 It happened after i changed the credentials in the Control panel -> Users -> Manage credentials. 它发生在我更改控制面板中的凭据 - >用户 - >管理凭据后。

I fixed it by adding a new credential: 我通过添加新凭证来修复它:

git: https://github.com (web credentials) and username and password. git: https//github.com (网络凭据)和用户名和密码。

I had this problem with github . 我和github有这个问题。 In my case the source of the problem was Two-factor authentication . 就我而言,问题的根源是双因素身份验证 I had it turned on , and when I turned it off - I got rid of that credential-error. 我有它打开 ,当我把它关闭 -我摆脱这个认证错误的。

That's a shame though that I have to keep Two-factor authentication off because of it. 这是一个耻辱,但我必须保持双因素认证的缘故吧。

I´m using GitExtension 2.4 6 (including msysgit 1.8.3) and I encountered the same problem. 我使用GitExtension 2.4 6(包括msysgit 1.8.3),我遇到了同样的问题。 Also reverting the installation of GitExtension 2.44 (with msysgit 1.8.1.2) doesn´t solve the problem. 还原GitExtension 2.44(使用msysgit 1.8.1.2)的安装也无法解决问题。

After some testing I came to the conclusion that my password is the problem, cause the latest release of the git-credential-winstore.exe fixes an issue with "=" in passwords . 经过一些测试后,我得出的结论是我的密码是问题,因为最新版本的git-credential-winstore.exe修复了密码中“=”的问题。

My password does not contain any = , but it contains a " and § . So my first thought was to update the installed version of git-credential-winstore.exe to the latest Version 1.2. I updated the file manually and tried it again, but with no success. 我的密码不包含任何= ,但它包含§ 。所以我的第一个想法是将已安装的git-credential-winstore.exe版本更新到最新版本1.2。我手动更新了文件并再次尝试,但没有成功。

Finally i have changed my password to not include any special characters and now it works. 最后我将密码更改为不包含任何特殊字符 ,现在可以正常使用。

Looks like the remote server is not able to authenticate you. 看起来远程服务器无法验证您。

You used an https:// URL. 您使用了https:// URL。 Therefore git uses https to connect to the remote repository. 因此git使用https连接到远程存储库。 The server answers with 401 (Unauthorized) and your git client prints the above error message. 服务器以401(未授权) 回答 ,您的git客户端打印上述错误消息。

Not sure, why the server does not like you. 不确定,为什么服务器不喜欢你。 Either name/password is not correct, or something strange is going on. 名称/密码不正确,或者发生了一些奇怪的事情。 Try to access the https:// URL with the browser. 尝试使用浏览器访问https:// URL。 Maybe this gives you an idea what the servers problem might be. 也许这可以让您了解服务器问题可能是什么。

You could also try to give name/password explicitly in the url: https://name:password@... . 您还可以尝试在URL中明确指定名称/密码: https://name:password@... (But server will probably still refuse authentication.) (但服务器可能仍会拒绝身份验证。)

EDIT: Confirmed, this seems to be an issue with Git v1.8.3 - switching to v1.8.1.2 solved the problem. 编辑:确认,这似乎是Git v1.8.3的一个问题 - 切换到v1.8.1.2解决了这个问题。 Download here . 在这里下载。 Thanks for helping out! 谢谢你的帮助!


Well, it just so happened that a colleague of mine had the exact same problem last night, independent of this question. 好吧,事实恰恰相反,我的一位同事昨晚出现了完全相同的问题,与此问题无关。

Like me, he had downloaded the latest official Git build - v1.8.3. 像我一样,他下载了最新的官方Git版本 - v1.8.3。 He proceeded to uninstall the latest build and installed v1.8.1.2 instead - and that solved the problem. 他继续卸载最新版本并安装了v1.8.1.2 - 这就解决了这个问题。

I'll give this a go when I get the chance and report back. 当我有机会并报告回来时,我会放手一搏。

With GitHub, you get this message if you are using 2-factor authentication and https Git. 使用GitHub,如果您使用双因素身份验证和https Git,则会收到此消息。

The solution is to create a personal access token which you use in place of your password. 解决方案是创建一个用于代替密码的个人访问令牌。

See https://github.com/blog/1614-two-factor-authentication 请参阅https://github.com/blog/1614-two-factor-authentication

Edit: It seems to be a curl bug/incompatibility with IIS when using anyauth and Windows Authentication actived 编辑:当使用anyauth和Windows身份验证激活时,似乎是一个卷曲bug /与IIS不兼容

Edit 2: It seems that installating msysgit 1.8.0-preview-20121022 fixes the problems 编辑2:似乎安装msysgit 1.8.0-preview-20121022修复了问题

Using more recente version of mssys git will fail with auth error. 使用更多版本的mssys git将失败并出现auth错误。 This can be reprocuced using curl/libcurl, the underlying Git provider for http/https. 这可以使用curl / libcurl重新记录,curl / libcurl是http / https的底层Git提供程序。

C:\Program Files (x86)\Git\bin\curl.exe --anyauth http://user:password@server/tfs/defaultcollection/_git/repo/info/refs?service=git-receive-pack

This works well 这很好用

C:\Program Files (x86)\Git\bin\curl.exe --digest http://user:password@server/tfs/defaultcollection/_git/repo/info/refs?service=git-receive-pack

So disabling Windows Authentication makes git work, but you loose everything else (access to services from VS or the TFS Management console !) 因此,禁用Windows身份验证会使git正常工作,但是您将丢失其他所有内容(从VS或TFS管理控制台访问服务!)

  1. On "tfs" node, activate "Digest Authentication" and disable everything else 在“tfs”节点上,激活“摘要式身份验证”并禁用其他所有内容
  2. On "Team Foundation Server" node, activate "Digest Authentication" and disable everything else 在“Team Foundation Server”节点上,激活“摘要式身份验证”并禁用其他所有内容
  3. On "Team Foundation Server" node, do Manage Website > Restart 在“Team Foundation Server”节点上,执行“管理网站”>“重新启动”

Was able to push and push tags after that (from git bash and git extensions) 之后能够推送和推送标签(来自git bash和git扩展)

Note: I use git 1.8.4.msysgit.0, git-credential-winstore 1.2 and Git Extensions 2.47.3 注意:我使用git 1.8.4.msysgit.0,git-credential-winstore 1.2和Git Extensions 2.47.3

Note2: Don't know if enabling other types of auths at the same time changes anything 注2:不知道是否同时启用其他类型的auth会改变任何东西

Note3: Not tried with passwords containing = or other "special" chars 注3:未尝试使用包含=或其他“特殊”字符的密码

在我的情况下,我不得不重新定义(禁用并再次启用)Team Foundation Server备用凭据,因为密码策略是强化的。

If you're using the Windows Credential Store for Git then the problem may be that you're using the buggy 1.3 version. 如果您正在使用Windows Credential Store for Git,那么问题可能在于您使用的是错误的1.3版本。

Troubleshoot the issue on the command using: 使用以下命令解决命令问题:

cmdkey /list

to list your current credentials in the Windows Credential Store. 列出Windows凭据存储中的当前凭据。

And to add your git credentials manually (for TFS Online in this case, but it's the same for Github): 并手动添加您的git凭据(在这种情况下为TFS Online,但对于Github来说是相同的):

cmdkey /generic:LegacyGeneric:target=git:https://mysite.visualstudio.com /user:MyName /pass:MyPass123

What I found was that after doing something like a git pull my credentials got deleted automatically. 我发现在做了像git pull这样的事情后,我的凭证被自动删除了。

Installing git-credential-store v1.2 fixed the problem for me. 安装git-credential-store v1.2为我解决了这个问题。 See: git push fails with git-credential-winstore 请参阅: git push使用git-credential-winstore失败

I also changed my "Alternate Credentials" password in my profile for my TFS Online account (their password policy has changed to now require 3 different character classes), as suggested in Barbara's answer. 我还在我的TFS在线帐户的配置文件中更改了我的“备用凭据”密码(他们的密码策略已更改为现在需要3个不同的字符类别),如Barbara的回答所示。

I had the same issue just now but I guess the cause might be a bit different. 我刚才有同样的问题,但我猜原因可能有点不同。

In my scenario I was trying to access a new TFS-git repo with the same account as I use to access another TFS repo. 在我的场景中,我试图使用与用于访问另一个TFS存储库相同的帐户访问新的TFS-git存储库。 The solution for me was to reinstall the git-credential-winstore.exe application and reinstall it. 我的解决方案是重新安装git-credential-winstore.exe应用程序并重新安装它。 I also removed the stored credentials in Windows credential manager. 我还删除了Windows凭据管理器中存储的凭据。 Link to git credentials application: http://gitcredentialstore.codeplex.com/ 链接到git凭证应用程序: http//gitcredentialstore.codeplex.com/

Hope this helps someone! 希望这有助于某人!

I was struggling with this issue myself using Windows 2008 (32bit), Git, GitExtensions. 我自己使用Windows 2008(32位),Git,GitExtensions来解决这个问题。

When prompted with the username/password box when attempting to push, I was getting the same message even though I was certain that I was using the correct username/password. 当尝试推送时出现用户名/密码框提示时,即使我确定我使用了正确的用户名/密码,我也收到了相同的消息。

Adding the user/password when configuring the origin fixed this for me: 在配置原点时添加用户/密码为我修复了这个问题:

git config remote.origin.url https://user:password@bitbucket.org/username git config remote.origin.url https:// user:password@bitbucket.org/username

I ran into this same problem recently, and it was because I wasn't using the proper url. 我最近遇到了同样的问题,那是因为我没有使用正确的网址。

bad url : https://github.com/blesh/myrepo 坏网址https://github.com/blesh/myrepohttps://github.com/blesh/myrepo

good url : https://github.com/blesh/myrepo.git <-- .git !!! 好网址https://github.com/blesh/myrepo.githttps://github.com/blesh/myrepo.git < - .git !!!

To check your remote urls: 要检查您的远程网址:

git remote -v

To fix your remote origin url: 要修复远程原始URL:

git remote set-url origin https://github.com/blesh/myrepo.git

Once I did this, everything worked fine again. 一旦我这样做,一切都恢复正常。

In our case, it was a problem with the server. 在我们的例子中,这是服务器的问题。 Our IT guy said that the git server was unable to reach the authentication server. 我们的IT人员说git服务器无法访问身份验证服务器。

I'm not sure what that means, but everything was promptly fixed after a quick server bounce and some other IT wizardry. 我不确定这意味着什么,但是在快速服务器退回和其他一些IT魔法之后,一切都得到了及时修复。

I was getting this error also. 我也得到了这个错误。 The only way to fix it was to create a secondary credential in visualstudio.com profile under credentials. 解决此问题的唯一方法是在凭据下的visualstudio.com配置文件中创建辅助凭据。 Using the secondary credential with git extensions fixed the error. 使用带有git扩展的辅助凭证修复了错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM