remote:用户名或密码无效.致命:身份验证失败

And*_*man 5 git github

我使用Git for Windows.我根据本文创建了SSH密钥并将其添加到我的GitHub设置的密钥列表中.现在我尝试使用它,但我收到错误:

$ git push origin master
Username for 'https://github.com': Andrey-Bushman
Password for 'https://Andrey-Bushman@github.com':
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/Andrey-Bushman/sandbox.git/
Run Code Online (Sandbox Code Playgroud)

我该如何解决?

Arp*_*wal 3

首先确保通过执行以下命令成功创建 ssh 密钥:

$ ssh -T git@github.com
Run Code Online (Sandbox Code Playgroud)

它应该打印 "Hi Andrey-Bushman! You've successfully authenticated, but GitHub does notprovide shell access."

如果没有,请参阅SSH 访问 Git

完成后,请按照以下步骤操作:

  1. 使用 ssh 协议克隆存储库:

    git@github.com:<github-username>/<repo>.git

    在你的情况下:

    git@github.com:Andrey-Bushman/<repo>.git

  2. 将您的更改提交到存储库。

  3. 然后,git push origin <branch-name>

    在你的情况下:

    git push origin master

  • 不,首先您必须使用 ssh“克隆”存储库,然后使用原始名称推送它。 (2认同)