当前位置:   article > 正文

[yotroy.cool]记一次将SSH公钥添加到GitHub

[yotroy.cool]记一次将SSH公钥添加到GitHub

个人博客https://www.yotroy.cool/,欢迎关注我哦~

============================================================

前言

ssh key又过期了,每次重新添加都要回看documentation,自己写一个方便记的。

步骤

Ubuntu为例

$ ssh-keygen -t rsa -b 4096

Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
$ #输入名字
$Enter passphrase (empty for no passphrase):  输入密码
$Enter same passphrase again: 再次输入密码
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

如果在输入名字处直接回车会输出如下

Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256: ....code..... root@system
  • 1
  • 2
  • 3
  • 4

直接cat指令

cat ~/.ssh/id_rsa.pub
  • 1

输出直接复制到GitHub的Add new SSH Key中即可。

测试

$ ssh -T git@github.com
  • 1

问题

可能存在国内无法连接问题,可尝试更换dns

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/428271
推荐阅读
相关标签
  

闽ICP备14008679号