美文网首页
添加SSH密钥到GitHub

添加SSH密钥到GitHub

作者: Chris__Liu | 来源:发表于2019-02-19 10:21 被阅读0次

Step 1、检查本机现有的SSH密钥

检查~/.ssh看看是否有名为d_rsa.pubid_dsa.pub的2个文件。如果你什么都没得到这些文件,转到 步骤2 ;否则,请跳到 第3步。

打开你的Git Bash,输入:

$ ls ~/.ssh

Step 2、创建一个新的SSH密钥

在Git Bash中输入:

ssh-keygen -t rsa -C "注册Github用的邮箱"  

过程可不管,直接一路回车。

Generating public/private rsa key pair.

Enter file in which to save the key (/c/Users/UsersName/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/UsersName/.ssh/id_rsa.
Your public key has been saved in /c/Users/UsersName/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:rwuerTS5wjzt86GtvvVt0jwm5nquIJWpdXt+kw2exYU 
The key's randomart image is:
+---[RSA 2048]----+
| |
| |
| . |
| o E .|
| = S . . |
| + o o . o |
| oo.* + o+ * |
| =+o@ *=.% . |
| =@*OO=*.o |
+----[SHA256]-----+

现在你的公钥已经保存在/c/Users/you/.ssh/id_rsa.pub中。

添加新的SSh密钥到ssh-keyen中:

在GitBash中输入复制这行

$ clip < ~/.ssh/id_rsa.pub

Step 3、将你的SSH key添加到GitHub

运行以下代码复制id_rsa.pub到剪切板:

现在将其添加到GitHub上(参考GitHub官网教程“Adding a new SSH key to your GitHub account”):

  1. 在页面的用户栏的右上角,单击 Settings
  2. 在左侧边栏点击 SSH and GPG keys.
  3. 点击 New SSH key ;
  4. 在Title标题区域中,为新的SSH密钥添加一个描述性标签。例如,如果您使用的是个人的PC,您可以调用这个关键的“Personal MacBook Air”;
  5. 粘贴您的钥匙插入 Key 区域中;
  6. 点击 Add SSH key ;
  7. 确认通过输入操作GitHub的密码。

Step 4、测试SSH key是否成功的添加到GitHub

$ ssh -T git@github.com # 用 ssh 连接 github

中途会有如下提示,选择yes即可:

Are you sure you want to continue connecting (yes/no)? yes

相关文章

  • 「物联网」64位Centos7下git部署

    安装git 生成密钥 添加密钥到github 登录 github点击头像->Settings->SSH And G...

  • 添加SSH密钥到GitHub

    Step 1、检查本机现有的SSH密钥 检查~/.ssh看看是否有名为d_rsa.pub 和id_dsa.pub的...

  • Git 操作

    添加github ssh本地生成公钥和密钥 然后在 .ssh文件夹里把公钥复制到github上面如果本地已经有公钥...

  • Flutter Engine 编译与调试

    一、环境搭建 1.1 GitHub帐户添加SSH密钥 https://docs.github.com/en/git...

  • 为github 添加ssh密钥

    打开命令行输入如下指令 然后连续三个回车,全部设为默认值详情请看官方帮助文档 成功生成密钥 使用vim去查看 id...

  • ubuntu同步github仓库

    1、安装hugo和git 2、生成密钥,将密钥添加到github cd ~ssh-keygen -t rsa -C...

  • Git SSH Key 生成步骤

    生成SSH密钥 添加密钥到git服务器 在C:\Users\Administrator.ssh\id_rsa.pu...

  • 配置分布式hadoop环境(*nix)

    基于配置单机hadoop的基础上继续 ssh连接密钥步骤1:改权限 ssh连接密钥步骤2:添加本机密钥到远程主机的...

  • git积累

    git添加SSH密钥 在github上新建了远程仓remote repository, 将本地仓locoal re...

  • 添加SSH密钥到你的github

    电脑是新买的mac。 现在又要折腾下博客和GitHub了。于是就要添加本地密钥到Github上来了啊。首先看下本地...

网友评论

      本文标题:添加SSH密钥到GitHub

      本文链接:https://www.haomeiwen.com/subject/gbhxyqtx.html