zoukankan      html  css  js  c++  java
  • git生成ssh key步骤并添加到github网站

    0: 查看是否已经有了ssh密钥

    执行命令:cd ~/.ssh
    如果没有密钥则不会有此文件夹,有则备份删除

    1:使用 Git Bash生成新的ssh key

    ssh-keygen -t rsa -C "772863869@qq.com"
    

    如果是*inux/ubuntu系统 ,请使用root权限

    2:指定RSA存放的目录

    Bash上会显示Enter file in which to save the key (/c/Users/youComputerName/.ssh/id_rsa):
    此时

    • 直接回车,那么RSA会生成到c/Users/youComputerName/.ssh文件夹下
    • 如果想把RSA存放到指定目录,那么输入地址,比如:d:/gitssh/filename
      其中,目录d:/gitssh必须已经存在,最后的filename是公钥、私钥文件的名字。

    然后,不需要密码,回车三次,RSA自动在目录下生成了。

    3:查找RSA的pub文件

    如果一切顺利的话,可以在存放的目录里找到.ssh目录,里面有id_rsaid_rsa.pub两个文件,
    这两个就是SSH Key的秘钥对,id_rsa是私钥,不能泄露出去,id_rsa.pub是公钥,可以放心地告诉任何人。

    4:添加SSH Key到github网站

    登陆GitHub,打开Settings-->SSH and GPG Keys页面: 然后点击New SSH Key

    填上任意Title,在Key文本框里粘贴id_rsa.pub文件的全部内容,最后点击Add SSH key完成添加内容

    5:测试是否添加成功

    输入命令: ssh -T git@github.com
    会有提示:

     Hi LiuwqGit! You've successfully authenticated, but GitHub does not provide 
    shell access.
    

    表明成功。

  • 相关阅读:
    mysql资料
    MySQL启动与关闭
    poj 2778 DNA Sequence
    poj 1625 Censored!
    zoj 3228 Searching the String
    hdu 4605 Magic Ball Game
    hdu 4610 Cards
    SGU 439 A Secret Book
    NOI2013
    NOI2014
  • 原文地址:https://www.cnblogs.com/weiqinl/p/6993240.html
Copyright © 2011-2022 走看看