使用ssh连接github

阅读更多
设置用户名和邮箱
jison@DESKTOP-U73UAPH MINGW64 /mingw64
$ git config --global user.name “your_username” 
jison@DESKTOP-U73UAPH MINGW64 /mingw64
$ git config --global user.email “your_registered_github_Email”

查询设置的用户名和邮箱
jison@DESKTOP-U73UAPH MINGW64 /mingw64
$ git config --global --get user.name
jisonami

jison@DESKTOP-U73UAPH MINGW64 /mingw64
$ git config --global --get user.email
[email protected]

查询是否有.ssh目录,有则先删除在创建
jison@DESKTOP-U73UAPH MINGW64 /mingw64
$ cd ~/.ssh
bash: cd: /c/Users/jison/.ssh: No such file or directory

jison@DESKTOP-U73UAPH MINGW64 /mingw64
$ ssh-keygen -t rsa -C "[email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/jison/.ssh/id_rsa):
Created directory '/c/Users/jison/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/jison/.ssh/id_rsa.
Your public key has been saved in /c/Users/jison/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:BK6LPTe0pB2KxKBRHSBuUsSsdWTE+XoE4KiEt9Wy34M [email protected]
The key's randomart image is:
+---[RSA 2048]----+
|.+*B=o.          |
|o*+.*o .         |
|**o.ooo .        |
|B= o +o.         |
|o + oo+ S        |
| . +.O.=         |
|  o *.E o        |
|     o . .       |
|                 |
+----[SHA256]-----+

查询创建的ssh私钥和公钥
jison@DESKTOP-U73UAPH MINGW64 /mingw64
$ cd ~/.ssh

jison@DESKTOP-U73UAPH MINGW64 ~/.ssh
$ ls
id_rsa  id_rsa.pub


将id_rsa.pub文件使用编辑器打开将文本内容复制到github上
登录github—》settings—》SSH and GPG keys

测试使用ssh连接github
jison@DESKTOP-U73UAPH MINGW64 ~/.ssh
$ ssh -T [email protected]
The authenticity of host 'github.com (192.30.252.131)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.131' (RSA) to the list of known hosts.
Hi jisonami! You've successfully authenticated, but GitHub does not provide shell access.

你可能感兴趣的:(ssh,git)