1.下载安装包安装
2. 安装
基本上都是默认选项,安装地址自己选一下。
3.检查git是否安装成功
在cmd窗口中,输入git,如下图显示则为成功。
4. 连接github
打开git bash,依次输入以下三个命令
git config --global user.name "你的GitHub用户名"
git config --global user.email "你的GitHub注册邮箱"
ssh-keygen -t rsa -C "你的GitHub注册邮箱"
如下图显示则成功。
然后在C:\Users\admin.ssh文件夹中找到id_rsa.pub文件(找不到可以在根目录下搜索),复制此文件中的全部内容。
在https://github.com/settings/keys中,点击“new ssh key”,自己设置一个title如ssh1,然后将刚刚复制的pub文件中的内容输入,点击确认即可。
5. 验证是否连接成功
在git bash中输入
ssh git@github.com
出现下面的提示即为成功。
yifan@DESKTOP-U9K0PFQ MINGW64 ~/Desktop
$ ssh git@github.com
The authenticity of host 'github.com (192.30.255.113)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com' (RSA) to the list of known hosts.
PTY allocation request failed on channel 0
Hi syuichihann! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.