git环境搭建记录
换地又要重新搭建环境,折磨一个下午,还是记录下防止以后再出事
1、
git config --global user.name “name”
git config --global user.email “xxx@qq.com.cn”
2、
ssh-keygen -t rsa -C xxx@qq.com.cn
(第一个输入生成rsa文件的名称,后两个是密码,建议不输入)
3、
上传公钥(带pub的rsa文件)
4、
在.ssh文件夹下创建config并配置
Host poc.xxx.com
HostName poc.xxx.com
User xxx.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_name
Port xxxx

5、
ssh -T git@poc.xxx.com 测试
第一次输入yes(因为.ssh缺少konwhost文件)
如果错误注意看提示信息
可以使用 ssh -Tvvv git@poc.xxx.com 查看链接过程中的日志
如果报出
debug1: Offering public key: /c/Users/Administrator.DESKTOP-KQ2PFAE/.ssh/id_rsa_name RSA SHA256:iaoSStbXzEtjU+sTr3PHlKZ3KMWblcaMBYvkUVQ2dWk explicit
debug1: send_pubkey_test: no mutual signature algorithm
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
git@poc.xxx.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
则是rsa算法已经废弃,需要在git本体的 /etc/ssh/ssh_config 中配置:
Host *
HostkeyAlgorithms +ssh-rsa # 使 openssh 支持 rsa 算法
PubkeyAcceptedAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa
浙公网安备 33010602011771号