git - 无法克隆 Git 存储库,即使我将公钥添加到 GIthub
问题描述
我买了一台新的 M1 Macbook Air,并开始在笔记本电脑上进行设置。我安装了 Git,并克隆了我的存储库
git clone git@github.com:xibotlab/homepage.git
然后出现了错误:
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我知道要解决这个错误我必须将 Git Public Key 添加到 Github,所以我输入了这个:
ssh-keygen -t ed25519 -C "xibotmoon@gmail.com"
我成功地将公钥添加到 Github。
但是即使我添加了公钥,上面也有错误。我在 Github 上搜索,但我无法解决这个问题,因为所有文件都说我必须添加公钥,我已经做到了!我该如何解决这个问题?
谢谢你。
解决方案
首先尝试切换到 HTTPS,尤其是对于公共存储库:
git clone https://github.com/xibotlab/homepage.git
关于 SSH,请先测试 SSH 访问权限,然后再尝试克隆:
ssh -Tv git@github.com
如果您没有看到欢迎消息,但同样的 Permission Denied 错误,您将需要调查更多调试信息。
推荐阅读
- outlook-addin - Outlook Web 插件:我们可以在上下文菜单中添加一个条目吗?
- spring - Spring Boot 应用程序需要一个带有 @Primary 注释的 bean 才能启动
- chart.js - 如何使图表的轴使用相同的比例进行缩放?
- sql-server - 寻找一种从我的查询中排除某些项目的方法
- git - 是否可以使用 Libgit2sharp 从特定标签克隆?
- macos - 为什么自制 apache 在启动时不启动?
- c# - 错误:IsObjectMonoBehaviour 只能从主线程调用
- caching - 什么是 CMake 缓存?
- c# - Unity 测试运行程序中未调用设置/拆卸,测试被阻止
- vuejs2 - 在 v-for 循环中使用插槽或插槽范围来访问属性?