• Windows 7下Git SSH 创建Key的步骤


    1、首先你要安装Git工具

    下载地址:https://git-scm.com/downloads

    2、右键鼠标,选中 “Git Bash here”,当然你也可以在windows的 “开始”--->“所以程序”,或者安装目录打开它

                                                    

    3、配置全局的name和email,这里是的你github或者bitbucket的name和email

     
    1. git config --global user.name "xkwg"  
    2. git config --global user.email "xkwg@163.com"  


    4、生成key

       ssh-keygen -t rsa -C "xkwg@163.com"  


          连续按三次回车,这里设置的密码就为空了,并且创建了key。

        Your identification has been saved in /User/Admin/.ssh/id_rsa.
        Your public key has been saved in /User/Admin/.ssh/id_rsa.pub.
        The key fingerprint is:
        ………………


    最后得到了两个文件:id_rsa和id_rsa.pub

    Administrator@20170412-034018 MINGW64 ~
    $ cd -
    /d/gitlab
    
    Administrator@20170412-034018 MINGW64 /d/gitlab
    $ ls
    htoa/
    
    Administrator@20170412-034018 MINGW64 /d/gitlab
    $ git config --global user.name "wangmo"        #设置用户名
    
    Administrator@20170412-034018 MINGW64 /d/gitlab
    $ git config --global user.email "wangmo@syberos.com"        #设置邮箱
    
    Administrator@20170412-034018 MINGW64 /d/gitlab
    $ ssh-keygen.exe -t rsa -C "wangmo@syberos.com"                #生成key
    Generating public/private rsa key pair.
    Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa):
    Created directory '/c/Users/Administrator/.ssh'.
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /c/Users/Administrator/.ssh/id_rsa.
    Your public key has been saved in /c/Users/Administrator/.ssh/id_rsa.pub.
    The key fingerprint is:
    SHA256:WXRsEqhSsYPfbSKJwQA34lLV7aVbaj+ljx3URvWtfao wangmo@syberos.com
    The key's randomart image is:
    +---[RSA 2048]----+
    |o.=....o .oo.   .|
    |.+ + .o.o.o.o  .o|
    |..  +.oo o.o  . o|
    |.   .+.+o+.  o o |
    |    ..+ S+o . + o|
    |       .+o ... ..|
    |       . . o. .  |
    |          +o o   |
    |          .oE    |
    +----[SHA256]-----+
    
    Administrator@20170412-034018 MINGW64 /d/gitlab
    $ ls ~/.ssh/id_rsa
    id_rsa      id_rsa.pub
    
    Administrator@20170412-034018 MINGW64 /d/gitlab
    $ ls ~/.ssh/id_rsa
    /c/Users/Administrator/.ssh/id_rsa
    
    Administrator@20170412-034018 MINGW64 /d/gitlab
    $ cat ~/.ssh/id_rsa.pub            #查看公钥
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCt2g+kYbK5Oc1UXAwjYxaaFLb0d0dwaaNbG17F3Po2                                                                                                                                                                                               bTn21XUcVmG+xpQ7CCjx9AA4exM8KWi+ZsEy/rIMF4jfSxgL/vPFlo5BAvAEqNWFt92AYjg9+z8DqYdM                                                                                                                                                                                               GMSiLzSmb1RtIevyMZjrnmlVIvLUe3gVUHQd9MnYwjmRYJ7g7Xaoq2KNstcoGIdZytToUP9YHLuR96Sm                                                                                                                                                                                               OMVT1033q/zQ3pDb8wcyAdpkuNgp/DA88JLt9cDY1LGtTZ6N1DzFDvT25WR+Y6bfj4c8KdeMfbDBMQiC                                                                                                                                                                                               XTauZAutLbyMNVI+gprc2mpAAwpYbQ5GUI06V7LAwPVRt+K2rXTXoi3dVL3b wangmo@syberos.com
    
    
    Administrator@20170412-034018 MINGW64 /d/gitlab
    $ git clone git@172.16.160.121:YiZhuangProject/www.git        #克隆
    Cloning into 'www'...
    The authenticity of host '172.16.160.121 (172.16.160.121)' can't be established.
    RSA key fingerprint is SHA256:G/1O8jbQXDexWy+8b0/zQs916tIkNIzn3Hxz1KFfzZQ.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '172.16.160.121' (RSA) to the list of known hosts.
    remote: Counting objects: 6560, done.
    remote: Compressing objects: 100% (2977/2977), done.
    remote: Total 6560 (delta 3412), reused 6534 (delta 3394)
    Receiving objects: 100% (6560/6560), 29.13 MiB | 27.32 MiB/s, done.
    Resolving deltas: 100% (3412/3412), done.
    Checking out files: 100% (5601/5601), done.
    
    Administrator@20170412-034018 MINGW64 /d/gitlab
    $ ls
    htoa/  www/

    5、添加key

    这是github添加key

    6、测试是否添加成功

    bitbucket输入命令:

     
    1. ssh -T git@bitbucket.org  

    提示:“You can use git or hg to connect to Bitbucket. Shell access is disabled.” 说明添加成功了

    github输入命令:

     
    1. ssh git@github.com  

    提示:“Hi lsyz0021! You've successfully authenticated, but GitHub does not provide shel l access.”说明添加成功。

  • 相关阅读:
    ARM的存储器映射与存储器重映射
    Nand Flash与Nor
    内核 任务的堆栈切换
    Linux设备模型(总结)
    file结构体中private_data指针的疑惑
    Sysfs文件系统与Linux设备模型
    认识udev
    Linux操作系统下的常见系统资源共享
    linux下的udev是干嘛的,能否说的通俗点
    udev详解
  • 原文地址:https://www.cnblogs.com/wangmo/p/6812053.html
Copyright © 2020-2023  润新知