问题
本文基于一次安装 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"
再次拉取,发现拉取成功
过程如下图