我有一个项目托管在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上给出的说明和许多堆栈讨论的建议,但没有办法。你知道我可能做错了什么吗?


当前回答

控制面板 证书管理器 寻找选项web凭据和windows凭据 在任何一个你会发现github凭证修复它与正确的凭证 打开新的git bash实例,你应该能够执行你的git命令。

这为我工作,我能够拉和推到我的远程回购。

其他回答

这个解决方案对我很有效:

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

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

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

我已经成功地使用以下命令。

git config --unset-all credential.helper
git config --global --unset-all credential.helper
git config --system --unset-all credential.helper

试着告诉我这些对你是否有效。

我也有同样的问题。我通过在客户端应用程序的repo设置中将远程分支的路径从https://github.com/YourName/RepoName更改为git@github.com:YourName/RepoName.git来解决这个问题。

如果你刚刚启用了2FA:

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

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