- 示例
- 说明
可以通过两种方式从命令行访问 GitHub 上的仓库:HTTPS 和 SSH,两者的身份验证方式不同
- 文档
在命令行上使用 HTTPS URL 将
git clone
、git fetch
、git pull
或git push
执行到远程存储库时,Git 将要求你提供 GitHub 用户名和密码。 当 Git 提示你输入密码时,请输入你的personal access token。 或者,可以使用 Git Credential Manager 等凭据帮助程序
Git 的基于密码的身份验证已被删除
比如,在通过 HTTPS 执行 git clone 命令,系统会提示输入用户名和密码。 当系统提示输入密码时,如果有 personal access token,请输入 personal access token 而不是密码
使用命令行进行身份验证
一、通过SSH从命令行访问GitHub上的仓库的身份验证方式
- 文章
《Github生成SSH密钥,使用SSH进行连接》https://blog.csdn.net/Oracle475/article/details/139349474
二、通过HTTPS从命令行访问GitHub上的仓库的身份验证方式
(1)personal access token
- 文档
- 说明
To access GitHub from the command line, you can use GitHub CLI or Git Credential Manager instead of creating a personal access token
GitHub 目前支持两种类型的 personal access token:
①fine-grained personal access token
②personal access tokens (classic)
GitHub 建议尽可能使用 fine-grained personal access token 而不是 personal access tokens (classic)
(2) GitHub CLI
- 文档
GitHub CLIhttps://docs.github.com/zh/github-cli/github-cli/about-github-cli
(3)Git Credential Manager
- 文档
Git Credential Managerhttps://github.com/git-ecosystem/git-credential-manager/blob/main/README.md