命令 git push origin master 不工作

Command git push origin master not working

我已经通过 ssh 成功连接到 github,如下面的命令所示。

Admins-MacBook-Pro-4:.ssh bobsmith$ ssh -T git@github.com
Warning: Permanently added the RSA host key for IP address '140.82.113.4' to the list of known hosts.
Hi bobsmith76! You've successfully authenticated, but GitHub does not provide shell access.

然而,当我 cd 到包含 .git 文件和 运行

的文件夹时
git push origin master

我明白了

remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/bobsmith/git_learn.git/'

当我访问 https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ 对于我应该做的事情,我真的没有看到任何非常不稳定的事情。我确实看到了

will require the use of token-based authentication, such as a personal access token (for developers) or an OAuth or GitHub App installation token (for integrators) for all authenticated Git operations on GitHub.com. You may also continue using SSH keys where you prefer.

但我认为我已经成功使用了 ssh 密钥。

您仍在尝试通过 https 而不是 ssh 进行推送,因此它会尝试通过 https.

进行身份验证

Select github-存储库中 Code-Button 的 ssh-Tab,并更改本地 git 存储库,使用以下命令。

git remote set-url origin <git-url>

url 应该是这样的:

git@github.com:<User>/<Repo>