在容器执行
bash
apt-get update && apt-get install -y vim #安装vim
# 生成秘钥
ssh-keygen -t rsa -b 4096 -C "SYSTEM@git.shijizhongyun.com" -f ~/.ssh/id_rsa_system
# 生成配置文件
touch ~/.ssh/config
# 编辑配置文件
vim ~/.ssh/config
//文件内容start
Host git.shijizhongyun.com
User git
IdentityFile ~/.ssh/id_rsa_system
//文件内容end
//查看公钥,并把公钥配置到git仓库
cat ~/.ssh/id_rsa_system.pub
本地也需要配置git的ssh证书,如果本地配置了ssh证书,调试的时候提示:
git@git.shijizhongyun.com: Permission denied (publickey)5.
fatal: Could not read from remote repository.
查看:C:\Users\BSI\.gitConfig文件中[url]是否只有一个,且与上面生成秘钥的账号一直。