git HTTP 基本:访问被拒绝致命:身份验证失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44514728/
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
HTTP Basic: Access denied fatal: Authentication failed
提问by Do Nhu Vy
I use GitLab Community Edition 9.1.3 2e4e522 on Windows 10 Pro x64. With Git client.
我在 Windows 10 Pro x64 上使用 GitLab 社区版 9.1.3 2e4e522。使用 Git 客户端。
Error
错误
Cloning into 'project_name'...
remote: HTTP Basic: Access denied
fatal: Authentication failed for 'http://[email protected]/my_user_name/project_name.git/'
How to fix it?
如何解决?
回答by Do Nhu Vy
Open CMD (Run as administrator) type command:
打开 CMD(以管理员身份运行)输入命令:
git config --system --unset credential.helper
then enter new password for Git remote server.
然后输入 Git 远程服务器的新密码。
回答by KlevisGjN
Im my case i was using Git Credential Manager for Windows (it was installed by default, I didn't install it manually)
我的情况是我使用的是适用于 Windows 的 Git Credential Manager(它是默认安装的,我没有手动安装)
Credentials Manager had saved my old password but i changed it lately.
凭证管理器保存了我的旧密码,但我最近更改了它。
If you are in the same conditions, to solve this problem: Go to Control Panel -> Credentials Manager and delete git account. After that it will ask you again for the credentials.
如果您处于相同的情况,要解决此问题:转到控制面板-> 凭据管理器并删除 git 帐户。之后,它会再次要求您提供凭据。
回答by Venkat Nadendla
Open CMD (Run as administrator) type command:
打开 CMD(以管理员身份运行)输入命令:
git config --system --unset credential.helper
then enter username and password for Git remote server.
然后输入 Git 远程服务器的用户名和密码。
回答by shdr
i coped with same error and my suggestion are:
我处理了同样的错误,我的建议是:
- Start with try build another user in git lab
- Recheck username & password (although it sounds obvious)
- Validate the windows cerdential (start -> "cred")
- Copy & paste same URL like you get from git lab, the struct should be:
- 从尝试在 git lab 中构建另一个用户开始
- 重新检查用户名和密码(虽然听起来很明显)
- 验证 Windows 证书(开始 -> “cred”)
- 复制并粘贴与 git lab 相同的 URL,结构应该是:
http://{srvName}/{userInGitLab}/{Repository.git} no '/' at the end
http://{srvName}/{userInGitLab}/{Repository.git} 末尾没有“/”
- Recheck the authorization in GitLab
- Give an attention to case sensitive
- 在 GitLab 中重新检查授权
- 注意区分大小写
Hope one of the above will solve it.
希望以上之一能解决它。
回答by AnonymusHelperq
This can happen also because of a change in the password and since Git Credential Manager caches it, so if that's the case 1. Open Credential Manager in Windows 2. Search for your GIT credential and reset it to the new password.
这也可能是由于密码更改以及 Git 凭据管理器缓存它而发生的,因此如果是这种情况 1. 在 Windows 中打开凭据管理器 2. 搜索您的 GIT 凭据并将其重置为新密码。
回答by sai
Go to your Credential manager => git credentials Check your git credentials and check your password.
转到您的凭证管理器 => git 凭证 检查您的 git 凭证并检查您的密码。
This worked for me.
这对我有用。
回答by jsimon
A simple git fetch/pull command will throw a authentication failed message. But do the same git fetch/pull command second time, and it should prompt a window asking for credential(username/password). Enter your Id and new password and it should save and move on.
一个简单的 git fetch/pull 命令将抛出一条身份验证失败的消息。但是第二次执行相同的 git fetch/pull 命令,它应该会提示一个窗口,要求提供凭据(用户名/密码)。输入您的 ID 和新密码,它应该保存并继续。
回答by Predhin Sapru
Edit the entry(possibly the password field that may have changed) for git: inside Generic Credentials section of Windows Credentials which can be accessed from Control Panel. Please note this is for Windows OS.
在可从控制面板访问的 Windows Credentials 的 Generic Credentials 部分中编辑 git: 的条目(可能是可能已更改的密码字段)。请注意,这是针对 Windows 操作系统的。
回答by Aditya
I use VS Code on my mac OS and GitLab for my project. I tried so many ways but it worked simply for me by resetting the remote origin of your project repository with the below command:
我在我的 mac OS 和 GitLab 上为我的项目使用 VS Code。我尝试了很多方法,但通过使用以下命令重置项目存储库的远程源,它对我很有效:
cd <local-project-repo-on-machine>
git remote set-url <remote-name> <remote-url>
for ex: git remote set-url origin https://<project-repository>.git
Hope it helps someone.
希望它可以帮助某人。
回答by Deb
For my case, I initially tried with
就我而言,我最初尝试使用
git config --system --unset credential.helper
git config --system --unset credential.helper
But I was getting error
但我收到错误
error: could not lock config file C:/Program Files/Git/etc/gitconfig: Permission denied
错误:无法锁定配置文件 C:/Program Files/Git/etc/gitconfig: Permission denied
Then tried with
然后尝试使用
git config --global --unset credential.helper
git config --global --unset credential.helper
No error, but still got access denied error while git pulling.
没有错误,但在 git pull 时仍然出现访问被拒绝错误。
Then went to Control Panel -> Credentials Manager > Windows Credential and deleted git account.
然后进入控制面板 -> 凭据管理器 > Windows 凭据并删除 git 帐户。
After that when I tried git pull again, it asked for the credentials and a new git account added in Credentails manager.
之后,当我再次尝试 git pull 时,它要求提供凭据并在 Credentails 管理器中添加一个新的 git 帐户。