我有一个项目托管在GitHub上。我失败时,试图推动我的修改在主人。我总是得到以下错误消息

Password for 'https://git@github.com': 
remote: Invalid username or password.
fatal: Authentication failed for 'https://git@github.com/eurydyce/MDANSE.git/'

但是,设置我的ssh密钥到github似乎没问题。实际上,当我执行ssh -T git@github.com时,我得到

Hi eurydyce! You've successfully authenticated, but GitHub does not provide shell access.

这似乎表明,一切都是OK从这一边(eurydyce是我的github用户名)。我严格按照github上给出的说明和许多堆栈讨论的建议,但没有办法。你知道我可能做错了什么吗?


当前回答

当我遇到这个问题时,我所做的解决方法是从我的github仪表板生成新的令牌,并将以下代码粘贴到我的终端

$ git远程设置url来源https://your-github-username:your-github-token@github.com/your-github-username/your-github-repo.git

其他回答

我也有同样的问题

$ git clone https://github.com/sample-url.git
Cloning into 'Project'...
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/sample-url.git/'

我只是git init,然后git clone <clone-url>

git init
git clone https://github.com/your-clone-Url

这对我很管用。

解决步骤:

控制面板 证书管理器 单击Windows凭证 在Generic Credential部分,将有git url,更新用户名和密码 重新启动Git Bash并尝试克隆

注意: 如果你在通用凭据部分没有找到git url,请遵循下面的答案 https://stackoverflow.com/a/55858690/7372432

我从bitbucket克隆应用程序时得到这个:

Cloning into 'YourAppName'...
Password for 'https://youruser id': 
remote: Invalid username or password

我解出来了。在这里,您需要为您的userid创建密码

点击你的个人资料和设置 然后创建应用密码选择你的名字密码将生成,粘贴该密码到终端

如果你刚刚启用了2FA:

修改。/git隐藏文件夹下的隐藏配置文件,如下所示:

[remote "origin"]
    url = https://username:PUT_YOUR_2FA_TOKEN_HERE@github.com/project/project.git

由于密码错误,有时会发生这种问题。请检查您是否连接了AD密码(Active Directory密码),并且您最近更改了AD密码,但仍在使用旧密码尝试git命令。

更新旧的AD密码

Control Panel > Credential Manager > Windows Credential > change github password with my new AD password