0.前言
在windows上使用Git工具往往需要使用SSH Key,和Linux系统使用不同,windows系统中常通过GUI方式生成SSH Key,若使用GUI方式那么PuTTY Key Generator便是一个不错的工具。如果在windows环境下需要先安装Git for windows,如果追求更良好的用户体验可安装SourceTree。
下面就详细说明如何通过PuTTY Key Generator生成SSH Key。
1.具体步骤
【1】打开软件,点击Generate

【2】在红色框中移动鼠标

【3】生成密钥,修改密钥说明

【4】保存密钥

【5】增加Key
例如可在github中增加Key,可复制第3部红色图框部分的Key。
Setting SSH Keys

【6】Git客户端(例如sourcetree)运行时,在托盘中有Pageant(远程登录服务工具)服务项目。进入Pageant可在该工具中增加Key。

【7】最后便可在Windows环境中顺利使用git工具了。
2.总结
其实操作步骤非常简单,通过移动鼠标的方式生成一个随机数,接着把key保存好,如有必要再把Key增到到Pageant工具中,最后便可放心大胆的使用Git工具了。
例外说明,如果使用HTTPS方式使用Git,那么就不需要使用SSH Key了,使用用户名和密码方式替代SSH Key。