You don't have any public SSH keys in your GitHub account. You can add a new public key, or try cloning this repository via HTTPS.
时间: 2024-03-26 12:36:25 浏览: 48
这个错误提示说明你的 GitHub 账户中没有添加公钥。在使用 SSH 协议克隆 GitHub 仓库时,需要在 GitHub 账户中添加公钥,才能进行身份验证。
你可以按照以下步骤添加公钥:
1. 打开终端,并执行以下命令生成 SSH 密钥:
```
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
```
其中,"your_email@example.com" 替换为你的电子邮件地址。
2. 按照提示输入文件名和密码,或者直接按 Enter 使用默认值。
3. 执行以下命令将公钥复制到剪贴板:
```
pbcopy < ~/.ssh/id_rsa.pub
```
如果你使用的是 Windows 系统,可以使用如下命令:
```
clip < ~/.ssh/id_rsa.pub
```
4. 登录到 GitHub 账户,在页面右上角的头像下拉列表中,选择「Settings」。
5. 选择左侧菜单栏中的「SSH and GPG keys」,点击「New SSH key」。
6. 在「Title」字段中输入一个标识符(例如,你的电脑名称),然后将剪贴板中的公钥粘贴到「Key」字段中。
7. 最后,点击「Add SSH key」即可完成设置。
添加成功后,你就可以使用 SSH 协议克隆 GitHub 仓库了。如果仍然遇到问题,可以尝试使用 HTTPS 协议进行克隆,或者检查 SSH 配置是否正确。
相关问题
Github 添加 ssh key 报错:Key is invalid. You must supply a key in OpenSSH public key format
您好!对于 GitHub 添加 SSH key 报错 "Key is invalid. You must supply a key in OpenSSH public key format",这通常是因为您提供的 SSH key 格式不正确所导致的。
要解决此问题,请确保您按照以下步骤操作:
1. 首先,打开终端或命令提示符窗口,在其中生成新的 SSH 密钥。可以使用以下命令生成新的 SSH 密钥:
```
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
```
请将 "your_email@example.com" 替换为注册 GitHub 账号时使用的电子邮件地址。
2. 在生成密钥时,系统将提示您选择存储密钥的位置和为密钥设置密码。如果您不需要为密钥设置密码,请直接按 Enter 键跳过。
3. 完成后,系统将生成一对 SSH 密钥,包括公钥(以 .pub 结尾)和私钥。默认情况下,它们将存储在 `~/.ssh/` 目录下。
4. 使用以下命令显示公钥:
```
cat ~/.ssh/id_rsa.pub
```
将这个公钥内容复制到剪贴板上。
5. 接下来,登录到 GitHub,转到您的账号设置页面,找到 "SSH and GPG keys" 选项。
6. 点击 "New SSH key" 或 "Add SSH key",然后粘贴您刚才复制的公钥内容。
7. 最后,点击 "Add SSH key" 或 "Add key" 完成添加。
这样,您应该能够成功添加 SSH key 到 GitHub 上了。如果问题仍然存在,请确保您正确按照上述步骤操作,并且在生成 SSH 密钥时没有做任何错误。
You can't push or pull repositories using SSH until you add an SSH key to your profile.
That's not a question, but I understand what you're saying. To push or pull repositories using SSH, you'll need to add an SSH key to your profile. You can generate an SSH key pair using the `ssh-keygen` command and then add the public key to your profile on the hosting service (e.g. GitHub, GitLab, Bitbucket). Once the key is added, you should be able to use SSH to interact with the repositories on that service.