git ssh协议连接远程仓库
背景: 之前连接远程仓库用的是https协议 ---在路飞05_002 远程仓库查https关键字
ssh协议连接远程的方式
方式1 输入用户名、密码
方式2 配置公钥、私钥 ---公司常用
如何设置:
在本地生成一个公钥和私钥,把公钥放到远端机器上,直接连, 不需要输用户名和密码.
---给别人的话是只能是公钥, 别人用公钥加密, 你用私钥解密就能看到了.
步骤
步骤1 生成公钥私钥
命令: ssh-keygen -t ed25519 -C "邮箱"
说明: 在任意位置执行该命令都可以
会在用户家路径的.ssh文件夹下生成公钥和私钥

步骤2 把公钥配置在远程仓库 ---本次为gitee
步骤2.1
在设置里找见公钥私钥

步骤2.2
配置完表示: 当前机器不需要输入用户名密码就可以操作gitee账号(即可以向远程仓库提交代码、拉取代码到本地)

步骤3
步骤3.1 把原来的凭据删掉
步骤3.1.1

步骤3.1.2

步骤4
步骤4.1 删除原来"远程仓库的项目名字和地址的对应关系"

步骤4.2 add 一个ssh的 remote地址对应关系
步骤4.2.1

步骤4.2.2

步骤5 测试
步骤5.1

步骤5.2

参考1

参考2
