美文网首页
Git SSH key配置

Git SSH key配置

作者: NIIIICO | 来源:发表于2022-06-23 16:42 被阅读0次

    一、生成SSH key

    ssh-keygen -t rsa -b 2048 -C "email@example.com"

    -t:指定要创建的密钥类型;
    -b:指定密钥长度;
    -C:添加注释;

    $ ssh-keygen -t rsa -b 2048 -C "email@example.com"
    
    Generating public/private rsa key pair.
    Enter file in which to save the key (/c/Users/zhaolin/.ssh/id_rsa):
    
    Created directory '/c/Users/zhaolin/.ssh'.
    
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    
    Your identification has been saved in /c/Users/zhaolin/.ssh/id_rsa
    Your public key has been saved in /c/Users/zhaolin/.ssh/id_rsa.pub
    The key fingerprint is:
    SHA256:wgFyDUWCMII4yXVwFaJmY3RgHQKpUmOuJa9EStJyktY email@example.com
    The key's randomart image is:
    +---[RSA 2048]----+
    |B+=OO@=o.        |
    |*+Bo*+o          |
    |.B.B  .          |
    |O+OE.. .         |
    |BO    o S        |
    |o..    .         |
    |..               |
    |.                |
    |                 |
    +----[SHA256]-----+
    
    

    二、SSH key设置

    1、打开生成的密钥路径 /c/Users/zhaolin/.ssh/

    2、查看公钥内容 id_rsa.pub

    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDfdVyxFNnK3ltn/dMNUhdo21ROQrS3HI19zFyOoNQvbplLi4D8V6NE2wWmVcMTGDzVfHoRvbF3DZOgr70mk6mOVW9+Ct1KVN2cgXEIfnqzYtzQPL6Tjzi+B1LAMi/Dhmu7q20YlxiF0mFsn+hS4wCwqKceS04R+SUwV6lXKQWpfZnC30iGBvB+8RtqvzbfH4YYAPyaBAjoKKSCtdBmVDVtxZKCv9nSUChhYkOB+gY90/UmOIZnDn9vtp2tPNT8LEfGzxlroCUpfvGZjlcquXyXIvDZnCSpmr56AunmhTTEZQg2qSO+lCR+2GHrU8sfPs8guijYMVWXB1/pMXOTYk6l email@example.com
    

    3、点击setting -> SSH and GPG keys -> New SSH key


    添加SSH key

    4、填写Title、Key,点击Add SSH key进行添加


    Add

    三、使用

    1、找到工程,点击Code -> SSH复制工程链接


    SSH链接

    2、使用 git clone git@github.com:Timey729/XPosedPlugin.git 下载工程。

    相关文章

      网友评论

          本文标题:Git SSH key配置

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