在安装github之前,你的生成ssh密匙,这样便于你将github生成的远程分支git下来
1 检查你的.ssh文件夹里面是否已经有之前的密匙了
cd ~/.ssh
查看是否有 id_rsa id_rsa.pub
文件,如果有那就证明,你已经存在了github的密匙
可以直接实用 vi id_rsa.pub
查看
如果没有的话 在.ssh文件夹下运行命令
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
然后跳出 Generating public/private rsa key pair.
不用管
然后跳出Enter a file in which to save the key (/home/you/.ssh/id_rsa):
这里直接enter跳过就好 ,跳过的话默认生成文件名 id_rsa id_rsa.pub
然后会跳出
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]
这里填的密码用于以后git文件,最好填github的登录密码,容易记。
然后就生成好了,但是现在密匙生成好,但是密匙还没有添加到系统还需要命令
eval "$(ssh-agent -s)"
以及
ssh-add ~/.ssh/id_rsa
然后就好了(如果不使用上面两个命令,会导致你在将远程分支拉下来的时候报错)
然后vi id_rsa.pub
查看密匙,将密匙加到github 的setting->SSH and GPG keys->New keys 就可以了。
unbunt18.04 安装 github 以及配置密匙
最新推荐文章于 2024-07-22 16:31:54 发布