GIT ---- GitHub配置SSH Key的完整步骤

1. 配置 SSH Key

由于提交代码每次输入用户名和密码,很繁琐,所以直接配置 SSH Key,直接自动验证,减少提交代码的操作步骤。

2. 查看配置命令

git config --list 查看当前Git环境所有配置,还可以配置一些命令别名之类的。

core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslcainfo=D:/git/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.required=true
filter.lfs.process=git-lfs filter-process
credential.helper=manager
user.name=Rattenking
user.email=1148063373@qq.com
alias.co=checkout
alias.ci=commit
alias.st=status
alias.pl=pull
alias.ps=push
:...skipping...
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslcainfo=D:/git/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.required=true
filter.lfs.process=git-lfs filter-process
credential.helper=manager
user.name=Rattenking
user.email=1148063373@qq.com
alias.co=checkout
alias.ci=commit
alias.st=status
alias.pl=pull
alias.ps=push
alias.df=diff
alias.lg=log
alias.cp=cherry-pick
alias.ca=commit -a
alias.br=branch
alias.mg=merge

3. 配置全局name和email

3.1 配置命令
git config --global user.name "xxx"
git config --global user.email "xxx"
3.2 配置结果

在这里插入图片描述

4. 切换到 ~/.ssh文件夹下

4.1 切换命令
cd ~/.ssh
4.2 切换结果

在这里插入图片描述

5. 检查是否存在SSH Key

5.1 检查命令
ls
或
ll
5.2 检查结果

在这里插入图片描述

由于我之前没有配置 SSH Key,所以不存在 id_rsa 和 id_rsa.pub文件,如果存在,说明已经有SSH Key。

6. 生成 SSH Key

6.1 生成命令
ssh-keygen -t rsa -C "xxx"
6.2 生成结果

在这里插入图片描述

注意:保存文件的名字输入 id_rsa!!!

6.3 再次查询

在这里插入图片描述

7. 获取SSH Key

7.1 获取命令
cat id_rsa.pub
7.2 获取结果

在这里插入图片描述

8. GitHub添加SSH Key

将第七步中的【ssh-rsa开头】密钥拷贝输入!!!
在这里插入图片描述
在这里插入图片描述

9. 验证

9.1 验证命令
ssh -T git@github.com
9.2 验证成功的输出

在这里插入图片描述

10. 总结

  1. 配置 SSH Key 完成,网上的教程很多,但是我们需要留下自己的记录,在自己需要的时候能够快速的找到!
  • 6
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Rattenking

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值