• Windows客户端配置GitHub的SSH公钥


    检查SSH keys的设置

    $ cd ~/.ssh/

    如果显示”No such file or directory”,跳到第三步,否则继续。

    备份和移除原来的SSH key设置

    如果已经存在key文件,需要备份该数据并删除之

    $ ls
    id_rsa  id_rsa.pub  known_hosts
    $ mkdir key_backup
    $ cp id_rsa* key_backup/
    $ rm id_rsa*

    生成新的SSH key

    输入下面的代码,可以生成新的key文件,只需要使用默认的设置即可,当需要输入文件名的时候,回车即可

    $ ssh-keygen -t rsa -C "你的邮箱@qq.com"
    Generating public/private rsa key pair.
    Enter file in which to save the key (/c/Users/WX/.ssh/id_rsa):
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /c/Users/WX/.ssh/id_rsa.
    Your public key has been saved in /c/Users/WX/.ssh/id_rsa.pub.
    The key fingerprint is:
    1d:cc:7e:b3:7e:92:f7:ab:c6:75:56:73:62:30:bc:8c 你的邮箱@qq.com
    The key's randomart image is:
    +--[ RSA 2048]----+
    |           .     |
    |         o  +    |
    |          +o +   |
    |         oE.o o.o|
    |        S o o. .+|
    |           . o .o|
    |            o....|
    |           .ooo  |
    |            o=.oo|
    +-----------------+
    Enter passphrase (empty for no passphrase):这里可以输入密码,在登录时验证

    添加SSH key到GitHub

    用文本编辑工具打开id_rsa.pub文件,如果看不到这个文件,你需要设置显示隐藏文件。准确的复制这个文件的内容,才能保证设置的成功。
    在GitHub的主页上点击设置按钮,选择SSH Keys项,把复制的内容粘贴进去,然后点击Add Key按钮即可,Title任意选择。

    测试一下

    输入下面命令,测试是否设置成功(第一次登录)

    $ ssh -T git@github.com
    The authenticity of host 'github.com (192.30.255.112)' can't be established.
    RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'github.com,192.30.255.112' (RSA) to the list of know
    n hosts.
    Enter passphrase for key '/c/Users/dyf/.ssh/id_rsa':(如果上一步设置密码 这里需要输入)
    Hi dyf007! You've successfully authenticated, but GitHub does not provide shell
    access.

    参考:http://codepub.cn/2015/06/02/Windows-client-configuration-of-SSH-public-key-on-GitHub/    (这里有设置多个sshKey的说明)

  • 相关阅读:
    Docker大会的新福利:LinuxKit 和 Moby 开源项目
    NS3
    (OK) NS3
    MPTCP
    Utilizing multi-core processors in NS-2
    (OK) Fedora 24
    error compiling gcc: undefined reference to libc_name_p
    gccxml
    NS3
    NS3
  • 原文地址:https://www.cnblogs.com/soul-mate/p/7496509.html
Copyright © 2020-2023  润新知