Alpine 中 Git 常见问题

44 篇文章 3 订阅

问题

本文基于一次安装 yapi 的实践,记录了安装过程中git遇到的问题

环境准备

  • 启动容器
docker run --name alpine-yapi -it /bin/sh
  • 安装软件
# apk 仓库更新
apk update 
# 安装 git 
apk add git

遇到问题

拉取git仓库时报错

git clone https://github.com/YMFE/yapi.git vendors
  • 错误一
    unable to access 'https://github.com/YMFE/yapi.git/': HTTP/2 stream 1 was not closed cleanly before end of the underlying stream
Cloning into 'vendors'...
fatal: unable to access 'https://github.com/YMFE/yapi.git/': HTTP/2 stream 1 was not closed cleanly before end of the underlying stream

原因是,git默认使用http/2.0协议,而github还是http/1.1 。解决方案:

git config --global http.version HTTP/1.1
  • 错误二
    再次拉取项目时发现还是报错,这次好的是
    fatal: unable to access 'https://github.com/YMFE/yapi.git/': Failed to connect to github.com port 443 after 21092 ms: Connection refused
fatal: unable to access 'https://github.com/YMFE/yapi.git/': Failed to connect to github.com port 443 after 21092 ms: Connection refused

原因是git默认开启了https校验,关不掉就可以了,解决方案如下

git config --global http.sslVerify "false"

再次拉取,发现拉取成功
过程如下图
在这里插入图片描述

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值