我已经使用GitHub有一段时间了,git添加、git提交和git推送都没问题,到目前为止还没有任何问题。突然我出现了一个错误

fatal:认证失败

在终端中,我克隆了一个存储库,处理了一个文件,然后我使用git add将文件添加到提交日志中,当我做git提交时,它工作得很好。最后,git push请求用户名和密码。我输入正确,每次我这样做,它都会显示相同的错误。

这个问题的原因是什么,我该如何解决它?

.git/config的内容如下:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url = http://www.github.com/######/Random-Python-Tests
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master
[user]
        name = #####
        email = ############

当前回答

在Windows上,尝试以下步骤编辑或删除保存的凭据:

Click Start Type: Credential Manager (on Windows 10, this is under "Start → Settings". Then search for "Credential Manager") See the Windows Credentials Manager shortcut and double-click it to open the application. Once the application is open, click on the Windows Credentials tab. Locate the credentials that you want to remove/update. They will start with "git:" and might begin with "ada:" Click on the credential entry. It will open a details view of the entry. Click Edit or Remove as required and confirm. Later rinse and repeat as necessary.

其他回答

我刚刚为我的Github帐户启用了双因素身份验证,所以我禁用了双因素身份验证,我可以用我的UID和PWD登录

如果您使用的是SSH,并克隆了HTTPS,这将不起作用。

用SSH进行克隆,然后按预期进行推拉!

这是我的解决方案,我认为它适用于Azure, Github或Git。如果您的身份验证失败可能是由于4个可能的原因—您启用了2FA,您更改了密码,您更改了用户名或回购密码是动态的)—

无论发生了什么,你都应该遵循以下四个步骤:

去任何你的回购位于点击“克隆”按钮。 应该有一个HTTPS的方式,下面点击“生成git凭证”按钮。这必须给你一个新密码。(Azure回购图)

在cmd中进入你的repo并输入: git push -u origin your-Branch-Name (如果需要)如果没有定义源url路由,只需输入下面的命令,然后再次执行步骤3: Git远程添加origin https://my-git-url git push命令后,它将询问您的凭据。使用已经在回购中生成的凭证。

问题说明:“git fatal authentication failed”。我在用Bitbucket。

解决方案:

我只是删除了使用Bitbucket访问管理的用户,然后添加了相同的用户。.gitconfig文件很简单:

[user]
    name = BlaBla
    email = blabla@gmail.com

[push]
    default = simple

在我的情况下,我最近更改了我的windows密码,我有SSH密钥配置git相关的动作(拉,推,获取等),在我遇到“致命:认证失败”错误后,我更新了我的密码在windows凭据管理器(控制面板\用户帐户\凭据管理器)的所有项目以git开始:…他又试了一次,这次成功了!