Windows客户端配置GitHub的SSH公钥

2021-08-12 10:57

阅读:880

标签:-o   lan   permanent   点击   编辑   ssh公钥   href   tar   rsa   检查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)? y 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的说明)Windows客户端配置GitHub的SSH公钥标签:-o   lan   permanent   点击   编辑   ssh公钥   href   tar   rsa   原文地址:http://www.cnblogs.com/soul-mate/p/7496509.html


评论


亲,登录后才可以留言!