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


当前回答

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

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

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

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

其他回答

这种情况发生的原因有很多。在我的案例中,没有一个解决方案有效。特别是,git拉origin master没有问我我的用户名和密码。

我在Windows上的github密码最近改了。我使用凭据管理器来管理我的密码。以下是对我有效的方法:

Confirm you are using the credential manager for git: git config --list … credential.helper=manager Run a new command prompt as administrator List all stored credential with cmdkey /list from C:\WINDOWS\system32> Remove the github target with cmdkey /delete:<target name>. In my case, the target name was github.<companyname>.com Open a new prompt and run a git command. You should get a popup asking for your usernmame and password. After providing the new credentials, it won't ask you for it again.

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

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

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

不需要依赖于生成个人访问令牌,然后尝试使用个人访问令牌在您的密码的地方。

快速修复方法是将远程URL设置为指向ssh而不是https。

这个git远程设置url来源git@github.com:用户名/存储库

解决步骤:

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

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

我只是关闭双因素认证,然后再试一次。这对我很管用。