美文网首页
github上如何生成并添加SSH key

github上如何生成并添加SSH key

作者: 奔波灞儿 | 来源:发表于2017-05-18 15:21 被阅读39次
    1、 ssh-keygen -t rsa -b 4096 -C "邮箱" 
      
    命令行输出:
        Generating public/private rsa key pair.
        Enter file in which to save the key (/Users/liuhongliang/.ssh/id_rsa):此处为了方便直接按回车,防止后面出现错误不知道怎么解决
    
        Enter passphrase (empty for no passphrase): 输入你的证书密码,验证时会用到
        Enter same passphrase again: 确认密码
    
    2、eval "$(ssh-agent -s)"
    
    3、ssh-add -K ~/.ssh/id_rsa
    

    此时已经生成了。

    验证

     4、ls -al ~/.ssh
    
    输出
      staff   170  5 18 14:42 .
      staff  1394  5 18 14:27 ..
      staff  3326  5 18 14:42 id_rsa
      staff   742  5 18 14:42 id_rsa.pub   // - 如果有它表示成功了
      staff   407  5 18 14:24 known_hosts
    
    5、pbcopy < ~/.ssh/id_rsa.pub   // 拷贝公钥
    

    6、 到github网站,

    image.png 2.png image.png image.png

    相关文章

      网友评论

          本文标题:github上如何生成并添加SSH key

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