创建SSH keys

1、检查是否已经有SSH Key存在

windows:

type "%userprofile%.sshid_rsa.pub"

Linux:

cat ~/.ssh/id_rsa.pub

如果存在,则进入第3步。

2、创建SSH keys

windows需要在git虚拟环境中运行,如果提示ssh-keygen,则先安装git,地址:

http://git-scm.com/download/win

如果很慢可以去百度盘下载:http://pan.baidu.com/s/1c2xd1ss

然后在任意文件夹下面点鼠标右键,选择 Git Bash Here

ssh-keygen -t rsa -C "GitLab" -b 4096

 linux无需安装,直接执行上面指令

全部默认值,回车

3、将SSH Key添加到git账号中

windiws运行下面指令会把公钥复制到剪贴板,然后粘贴到gitlab的user profile里面即可。

type "%userprofile%.sshid_rsa.pub" | clip

 linux运行之后再手动复制:

cat ~/.ssh/id_rsa.pub
原文地址:https://www.cnblogs.com/windchen/p/6222434.html