我正在尝试设置我的git,以便克隆/push/pull/。。。在终端中从GitHub到GitHub,而没有输入我的用户名和密码,但我收到了这个错误:
❯ git clone https://github.com/Johannes-Krabbe/private-repo.git
Cloning into 'private-repo'...
Username for 'https://github.com': Johannes-Krabbe
Password for 'https://Johannes-Krabbe@github.com':
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/Johannes-Krabbe/private-repo.git/'
我遵循了以下两个教程:
- https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
- https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account
当我运行❯ ssh -T git@github.com
时,我得到这个输出:
Hi Johannes-Krabbe! You've successfully authenticated, but GitHub does not provide shell access.
通过ssh使用git时,不能使用https://
URL,而是使用特定的ssh地址。在您的情况下,使用git@github.com:Johannes-Krabbe/private-repo.git
访问您的存储库。