windows下通过ssh连接github

(1) 检测ssh是否存在;

输入ls -al ~/.ssh,如果没有,显示 No such file or directory。否则,显示id_rsaid-rsa.pub

windows下通过ssh连接github

(2) 如果没有,配置ssh;输入ssh-****** -t -rsa -C “你注册github填写的邮箱地址”。

windows下通过ssh连接github

(3) windos系统在目录C:\Users\用户名\.ssh下找到你的**。id_rsa对应你的私钥,id_ras.pub对应你的公钥,用记事本打开id_rsa.pub,复制你的公钥并且添加到你的github

a选择seetings

windows下通过ssh连接github

b 选择ssh and GPG keys

 windows下通过ssh连接github

C 点击New SSH Key

windows下通过ssh连接github

d  title里面输入随便设置。key里面粘贴你复制的公钥即可

windows下通过ssh连接github

E 点击Add SSH Key。完成。

(4) 添加Keyssh

输入ssh-add  ~/.ssh/id_rsa 或者ssh-add id_rsa

windows下通过ssh连接github

如果失败,如果ssh-agent bash,再次输入ssh-add  ~/.ssh/id_rsa 或者ssh-add id_rsa

(5) 检测ssh key

输入ssh -T [email protected]

windows下通过ssh连接github

如图表示成功。因为在生成ssh key时,我没有输入密码,所以后面的提示不用管,稍等就会出现底下的successfully。如果设置了密码,则需要输入你设置的密码。