github - 我通过我的 SSH 密钥在 Github 上成功进行了身份验证,但是如何克隆/推送/拉取(私有)存储库?
问题描述
我按照 Github 上关于如何注册我的 SSH 密钥的官方解释,根据他们的文档,一切都应该工作:
$ ssh -T git@github.com
Hi username! You've successfully authenticated, but GitHub does not
provide shell access.
不幸的是,这并没有说明如何克隆/推送/拉取存储库,并且在任何地方都没有相关文档。
例如,刚刚创建了一个新的(私有)存储库,我复制了存储库地址并尝试了:
git clone https://github.com/myusername/mynewrepository.git
我只收到
Cloning into 'mynewrepository'...
Username for 'https://github.com': myusername
Password for 'https://myusername@github.com':
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/myusername/mynewrepository.git/'
问题:在 Github 上的(私有)存储库上执行 Git 操作的确切命令是什么?
解决方案
如果您想使用 SSH 密钥进行 git 操作,请使用:
git clone git@github.com:myusername/mynewrepository.git
...如文档中所述。SSH 密钥不会影响任何基于 HTTPS 的连接
推荐阅读
- spring-boot - 从 LinkedHashMap 转换的 Kotlin
到字符串? - javascript - 我将如何在 JavaScript 中获得两个月(YYYYMM)之间的差异?
- java - 为什么我无法将 apk 上传到 Google Play?需要相机隐私政策
- javascript - 科尔多瓦应用程序中的警报功能返回 [object, Object]
- excel - 从文件中删除用户功能区
- javascript - 一种告诉 Webpack `import "someFile.js"` 意味着 `import "someFile.ts"` 的方法?
- html - 尽管有 Google Ad Manager 点按区域退出事件,但“缺少点击代码”
- java - 无法在 lambda 表达式中触发异常
- python - ValueError:检查输入时出错:预期dense_1_input的形状为(9,)但得到的数组形状为(1,)
- python - 使用 numpy 对大量数据进行去相关