我有一个项目托管在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令牌:

https://github.com/settings/tokens

然后:

git remote set-url origin https://[token]@github.com/your_repository

其他回答

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

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

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

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

运行下面的命令,然后在每一次推拉之后,它会要求你输入用户名和密码。

  git config credential.helper ""

现在当你拉/推你将被要求git凭证。不管你是通过命令提示符还是Intellij Git运行。

因为你可能想让你的账户启用2FA,你可以设置一个ssh密钥,这样你就不需要每次你想把工作推送到Github时都输入你的Github凭据。

您可以在文档中找到所有的ssh设置步骤。首先,确保当前没有任何ssh密钥(id_rsa. exe)。Pub,等等)使用$ ls -al ~/.ssh

我通过安装GitHub CLI并运行gh auth登录来解决我的问题

看到的: https://docs.github.com/en/get-started/getting-started-with-git/caching-your-github-credentials-in-git#github-cli

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

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