1、receive-pack 问题
做整合代码时将旧的项目建立仓库,然后推送到远程仓库时,出现超时问题。
因为远程仓库部署在Linux中,采用的技术方案是 Tengine 2.2.3
和 Gogs 1.10.1
,
所以查阅两个服务的日志文件时,发现了问题。日志如下:
// gogs日志
2020/03/19 17:01:50 [ERROR] [.../routes/repo/http.go:260 serviceRPC()] HTTP.serviceRPC: fail to serve RPC 'receive-pack': exit status 128 - fatal: The remote end hung up unexpectedly
// Tengine error日志
2020/03/19 17:02:35 [error] 16703#0: *232644 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 36.5.156.186, server: github.xulizhong.top, request: "POST /wlzhp/miniApp_guoyuan_store.git/git-receive-pack HTTP/2.0", upstream: "http://127.0.0.1:8002/wlzhp/miniApp_guoyuan_store.git/git-receive-pack", host: "github.xulizhong.top"
可以从gogs
日志中看到错误原因是 receive-pack
,出现这个错误的原因是,
当使用 HTTPS 提交到 Git 上时,使用不检查加密,如果提交的内容过多将导致提交停止
解决方案
- 使用 Git 提交代码 在本地仓库中输入指令
git config http.postBuffer 524288000
- 使用 SourceTreee 提交代码 如图按照顺序依次点击在最后一步增加
Loading...
[http]
postBuffer = 524288000
2、PROTOCOL_ERROR错误
在提交大体积文件时出现
error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
解决方案
- 更改Git的http版本
git config --global http.version HTTP/1.1
- 更改Git的拉取和提交为
ssh
方式