将 SSH 密钥添加到 GitHub 的问题 [英] Issue on adding SSH key to GitHub

查看:33
本文介绍了将 SSH 密钥添加到 GitHub 的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个似乎与 GitHub 使用的 SSH 密钥格式有关的问题.我使用 Git Bash 生成新的 SSH 密钥:

I have got an issue that seems about the format of SSH key used by GitHub. I used Git Bash to generate a new SSH key:

$ ssh-keygen -t rsa -C "youremail@youremail.com"

然后,我将密钥复制到 GitHub 帐户页面设置中的 SSH 部分.但是,它附带了如下问题通知:

Then, I copied the key to the SSH section in settings of my GitHub account page. However, it came with the issue notice as follows:

Key is invalid. It must begin with 'ssh-ed25519', 'ssh-rsa', 'ssh-dss', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', or 'ecdsa-sha2-nistp521'. Check that you're copying the public half of the key

之后,我编辑了我的 SSH 密钥,以 ssh-rsa 开头,最后是我的电子邮件地址.但是,问题仍然存在.

Following that, I edited my SSH key starting with ssh-rsa and my email address at the end. However, the issue is still there.

有什么办法解决这个问题?

What is the solution to this? 

推荐答案

只需按照以下步骤操作,您将立即设置 SSH 密钥:

Simply follow these steps and you will set up your SSH key in no time:

  • 生成新的 ssh 密钥(如果已有密钥,则跳过此步骤)ssh-keygen -t rsa -C "your@email"

home/.ssh 目录(或 Windows 下的 Users/.ssh)中设置密钥后,打开它并复制内容

Once you have your key set in home/.ssh directory (or Users/<your user>.ssh under windows), open it and copy the content

  • 登录GitHub账号

  • Login to the GitHub account

点击右上角的牧场主(设置)

Click on the rancher on the top right (Settings)

点击 SSH 密钥

点击添加SSH密钥

粘贴您的密钥并保存

你们都准备好了:-)

这篇关于将 SSH 密钥添加到 GitHub 的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆