git安装生成rsa密钥并连接github

版权声明:本文为博主原创文章,未经博主允许不得转载。个人博客:www.saoguang.top https://blog.csdn.net/u011580175/article/details/82292427

安装git

  1. 在 Fedora上用yum安装 :
    yum install git-core
  2. 在Ubuntu上使用apt-get :
    apt-get install git

生产自己的rsa公钥和密钥

  • 命令行下执行 ssh-keygen -t rsa -C "你的email地址"
    比如我的ssh-keygen -t rsa -C "[email protected]"
  • 下面就会有提示输入,公钥和私钥的存储位置和密码。我直接一路Enter
  • 默认存储在/home/zg/.ssh

    • 目录下的:
    • 公钥 : id_rsa.pub
    • 私钥 : id_rsa
  • 查看公钥内容
    cat /home/zg/.ssh/id_rsa.pub

  • 复制公钥内容到github个人设置中的SSH and GPG keys中的 New SSH key中。

测试与 github是否连接成功

运行命令 : ssh -T [email protected]
显示结果 : Hi saoguang! You’ve successfully authenticated, but GitHub does not provide shell access. 代表成功。

猜你喜欢

转载自blog.csdn.net/u011580175/article/details/82292427