多个平台管理SSH Key冲突,git clone出错问题

突然有一天,发现github上git clone时,总down不下来代码,给出一句:RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54。

出现curl 56时,可能是git 缓存不够,按如下配置即可:

git config http.postBuffer 524288000

当出现errmo 54时,一定是SSL验证出现了问题。

所以有可能是配置不同平台的SSL时,将本地的id_rsa覆盖了,所以验证不通过。解决办法如下:

下面以配置Github的ssh key为例。

1. 生成ssh key时同时指定保存的文件名

> ssh-keygen -t rsa -f ~/.ssh/id_rsa.github -C "邮箱"

上面的id_rsa.github就是我们指定的文件名,这时~/.ssh目录下会多出id_rsa.githubid_rsa.github.pub两个文件,id_rsa.github.pub里保存的就是我们要使用的key。

2. 配置ssh config文件,如果文件不存在就创建

> vim ~/.ssh/config
# github
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa.github

# gitlab
Host gitlab.com
Hostname altssh.gitlab.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa.gitlab

# gitee
Host gitee.com
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa.gitee

3. 测试ssh 是否配置成功,以Github为例

> ssh -T git@github.com

如果配置成功,则会显示:
Hi username! You’ve successfully authenticated, but GitHub does not provide shell access.

感谢JouyPub大神文章:http://www.jouypub.com/2018/0959250d1c900128efc07cf055dfeb62/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值