Git SSH Key生成步骤

来源:互联网 发布:wol网络唤醒 编辑:程序博客网 时间:2024/05/23 19:17
  1. 设置Git的user name和email:

    $ git config --global user.name "xxx"
    $ git config --global user.email "xxxx@gmail.com"

  2. <span style="font-size: 14px; line-height: 26px; color: rgb(34, 34, 34); font-family: Helvetica, Arial, sans-serif;">查看是否已经有了ssh密钥:cd ~/.ssh</span><br style="font-size: 14px; line-height: 26px; color: rgb(34, 34, 34); font-family: Helvetica, Arial, sans-serif;" /><span style="font-size: 14px; line-height: 26px; color: rgb(34, 34, 34); font-family: Helvetica, Arial, sans-serif;">如果没有密钥则不会有此文件夹,有则备份删除</span>
  3. <span style="font-size: 14px; line-height: 26px; color: rgb(34, 34, 34); font-family: Helvetica, Arial, sans-serif;"></span><p class="p1"><span class="s1"># </span>生成私钥<span class="s1">&</span>公钥</p><p class="p2">$ ssh-keygen -t rsa -C <span class="s2">"97606813@qq.com"</span></p>
  4. # 查看公钥内容

    $ cat oschina_rsa.pub

    # 选中输出的内容 cmd+c,到 oschina上添加公钥 cmd  + v

  5. # 开启agent程序

    $ eval "$(ssh-agent -s)"

  6. #注意, 添加的是私钥,不是pub

    $ ssh-add ~/.ssh/oschina_rsa

    # 验证账号

    $ ssh -T git@git.oschina.net

  7. 提示:只要看到以下内容,今后就再也不用管密码了!

    Welcome to Git@OSC


  8.  开始使用github
    1.获取源码:

    $ git clone git@github.com:billyanyteen/github-services.git 


0 0