利用ssh-keygen生成 SSH Key

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/liuqinglong_along/article/details/51861664

我们在使用分布式版本控制工具Git时,远程代码的管理是基于SSH协议的,故如果要远程操作Git则需要配置SSH。

1、设置Git的用户名和邮箱地址

git config --global user.name "lql"
git config --global user.email "...@os_cpu.cn"

2、生成SSH密钥过程

首先检查一下是否已经有了ssh密钥,如果没有密钥,在不会有如下目录。

cd ~/.ssh
按如下指令生成密钥:

ssh-keygen -t rsa -C "xxx@os_cpu.cn"
然后直接按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


3、把id_rsa.pub里的内容复制到github里就可以了。

猜你喜欢

转载自blog.csdn.net/liuqinglong_along/article/details/51861664