git GitLab 远程:HTTP Basic:拒绝访问和致命身份验证

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/47860772/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:12:51  来源:igfitidea点击:

GitLab remote: HTTP Basic: Access denied and fatal Authentication

gitgitlab

提问by jeancode

I am on mac OS unlike this post:

与这篇文章不同,我使用的是 mac OS:

I have password configured in GitLab.

我在 GitLab 中配置了密码。

I have SSL key created AFTER the project was made on GitLab.

我在 GitLab 上创建了项目后创建了 SSL 密钥。

When I use an existing folder for a new project and follow the steps below:

当我将现有文件夹用于新项目并按照以下步骤操作时:

Existing folder

现有文件夹

cd existing_folder
git init
git remote add origin https://gitlab.com/sobopla/Geronimod.git
git add .
git commit -m "Initial commit"
git push -u origin master

I am prompted to enter my GitLab username and password. After password is entered I get:

系统提示我输入我的 GitLab 用户名和密码。输入密码后,我得到:

remote: HTTP Basic: Access denied fatal: Authentication failed for 'https://gitlab.com/myname/myproject'

远程:HTTP 基本:访问被拒绝致命:“ https://gitlab.com/myname/myproject”的身份验证失败

回答by mpro

It happen every time I'm forced to change the Windows password and none of above answers helped to me.

每次我被迫更改 Windows 密码时都会发生这种情况,而且上述答案都没有帮助我。

Try below solution which works for me:

尝试以下对我有用的解决方案:

  1. Go to Windows Credential Manager. This is done in a EN-US Windows by pressing the Windows Key and typing 'credential'. In other localized Windows variants you need to use the localized term (See comments for some examples).

    alternativelyyou can use the shortcut control /name Microsoft.CredentialManagerin the run dialog (WIN+R)

  2. Edit the git entry under Windows Credentials, replacing old password with the new one.
  1. 转到 Windows凭据管理器。这是在 EN-US Windows 中通过按 Windows 键并键入“凭据”来完成的。在其他本地化的 Windows 变体中,您需要使用本地化的术语(一些示例见注释)。

    或者,您可以使用control /name Microsoft.CredentialManager运行对话框中的快捷方式 (WIN+R)

  2. 编辑 Windows Credentials 下的 git 条目,用新密码替换旧密码。

回答by hatanooh

   git config --system --unset credential.helper

then enter new password for Git remote server.

然后输入 Git 远程服务器的新密码。

回答by Bharti Ladumor

I got the same error and I solved this by :

我遇到了同样的错误,我通过以下方式解决了这个问题:

  1. Apply command from cmd (run as administrator)

    git config --system --unset credential.helper

  2. And then I removed gitconfigfile from C:\Program Files\Git\mingw64/etc/location (Note: this path will be different in MAC like "/Users/username")

  3. After that use git command like git pullor git push, it asked me for username and password. applying valid username and password and git command working.
  1. 从 cmd 应用命令(以管理员身份运行)

    git config --system --unset credential.helper

  2. 然后我从C:\Program Files\Git\mingw64/etc/位置删除了gitconfig文件(注意:此路径在 MAC 中会有所不同,如“/Users/username”)

  3. 之后使用 git 命令像git pullorgit push,它要求我输入用户名和密码。应用有效的用户名和密码以及 git 命令工作。

hope this will help you...

希望能帮到你...

回答by JavAlex

For me, the following worked:

对我来说,以下工作:

Do not use your GitLab password, but create an access tokenand use it instead of your password:

不要使用您的 GitLab 密码,而是创建一个访问令牌并使用它代替您的密码:

  1. In GitLab, go to Settings> Access Tokens
  2. Create a new token (check api)
  3. git clone ...
  4. When you are asked for your password, copy and paste the access token instead of your GitLab password
  1. 在 GitLab 中,转到设置>访问令牌
  2. 创建一个新令牌(检查api
  3. git克隆...
  4. 当系统要求您输入密码时,请复制并粘贴访问令牌而不是您的 GitLab 密码

回答by Paulo Morgado

The only thing that worked for me was using https://username:[email protected]/user/projectgitinstead of https://gitlab.com/user/projectgit. See https://gitlab.com/gitlab-com/support-forum/issues/1654

唯一对我有用的是使用https://username:[email protected]/user/projectgit而不是https://gitlab.com/user/projectgit. 见https://gitlab.com/gitlab-com/support-forum/issues/1654

回答by Andy Quiroz

Go to Windows Credential Manager (press Windows Key and type 'credential') to edit the git entry under Windows Credentials. Replace old password with the new one.

转到 Windows 凭据管理器(按 Windows 键并键入“凭据”)以编辑 Windows 凭据下的 git 条目。用新密码替换旧密码。

Windows Credential Manager

Windows 凭据管理器

回答by Kshama Jain

I was also facing the same issue. The reason for the problem was authentication error. To solve this problem go to Control Panel -> Credential Manager -> Generic Credentialshere find your gitlab credential and edit them. Make sure your ID password is right or not

我也面临同样的问题。问题的原因是身份验证错误。要解决此问题,请转到“ 控制面板”->“凭据管理器”->“通用凭据”,找到您的 gitlab 凭据并对其进行编辑。确保您的 ID 密码正确与否

enter image description here

在此处输入图片说明

回答by Pigueiras

If you are using git > 2.11 and using Kerberos to interact with Gitlab you need set this configuration in your local git to avoid the remote: HTTP Basic: Access deniederror.

如果您使用 git > 2.11 并使用 Kerberos 与 Gitlab 交互,则需要在本地 git 中设置此配置以避免remote: HTTP Basic: Access denied错误。

$ git config --global http.emptyAuth true

$ git config --global http.emptyAuth true

Source

来源

回答by gal007

Just add your username before the domain:

只需在域之前添加您的用户名:

https://**username**@gitlab.com/user/projectgit

And the assistant will ask you the password

然后助手会问你密码

回答by Dyno Cris

It happens if you change your login or password of git service account (GitHub or GitLab, Bitbacket, etc). You need to change it in Windows Credentials Manager too.

如果您更改了 git 服务帐户(GitHub 或 GitLab、Bitbacket 等)的登录名或密码,就会发生这种情况。您也需要在 Windows 凭据管理器中更改它。

So, type "Credential Manager" (rus. "Диспетчер Учетных Данных") in Windows Search menu and go to your git service account and change data too.

因此,在 Windows 搜索菜单中输入“凭据管理器”(俄语“Диспетчер Учетных Данных”),然后转到您的 git 服务帐户并更改数据。

enter image description here

在此处输入图片说明