前言
安装完git之后,第一次使用git拉取远程仓库。
一、生成SSH
打开git bash,输入下面三条。
git config --global user.name "注册名" #用户名
git config --global user.email "注册邮箱" #邮箱
ssh-keygen -t rsa -C "自己的邮箱" #生成ssh,敲三次回车
SSH文件存放在C:/User/用户/.ssh下,id_rsa为私钥,id_rsa.pub为公钥。
二、github配置SSH
打开id_rsa.pub文件,全选,复制全文,粘贴到github的ssh key设置中。
三、添加config文件
克隆项目时,报Unable to negotiate with **** port 22: no matching host key type found. Their offer: ssh-rsa
错误。
解决方法:
到当前用户目录下的.ssh文件中创建config文件(config没有后缀)
Host *
KexAlgorithms +diffie-hellman-group1-sha1
HostkeyAlgorithms +ssh-dss,ssh-rsa
PubkeyAcceptedKeyTypes +ssh-dss,ssh-rsa