Git SSH Key 生成步骤

Git是分布式的代码管理工具,远程的代码管理是基于SSH的,所以要使用远程的Git则需要SSH的配置。

github的SSH配置如下:

一 、

设置Git的user name和email:

$ git config --global user.name "your-name"

$ git config --global user.email "your-email"

二、生成SSH密钥过程:

1.查看是否已经有了ssh密钥:cd ~/.ssh

如果没有密钥则不会有此文件夹,有则备份删除

2.生成密钥:

这里有个坑,其实没必要加-C “your maile address”

推荐使用

ssh-keygen -t rsa

按3个回车,密码为空。

Your identification has been saved in /home/tekkub/.ssh/id_rsa.

Your public key has been saved in /home/tekkub/.ssh/id_rsa.pub.

The key fingerprint is:

………………

最后得到了两个文件:id_rsa和id_rsa.pub

id_rsa为密钥

id_rsa.pub为公钥

3.在github上添加ssh密钥,这要添加的是“id_rsa.pub”里面的公钥。

原文地址:https://www.cnblogs.com/jwentest/p/7512488.html