Azure Pipelines执行Git拉取/推送时遇SSL_SYSCALL错误(errno 0)求助
问题:Azure Pipelines中Git操作出现SSL_ERROR_SYSCALL错误
我用Azure Pipelines搭建CI/CD流程,在构建发布前通过Bash任务更新网站版本号并推送到Bitbucket Cloud,之前运行正常,但上周开始执行git pull或git push时流水线失败,报错:
fatal: unable to access 'https://bitbucket.org/site/repo': OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 0
相关情况
- 使用OAuth连接Bitbucket Cloud,已设置OAuth在任务间持久化
- 本地两台机器执行相同Git命令均正常
附执行的Bash脚本及Git配置
Bash脚本
#!/bin/bash git config --global http.postBuffer 524288000 git config http.timeout 600 git config --global --unset-all remote.origin.proxy git config --global --unset https.proxy git config --global --unset http.proxy git config --global http.sslVerify false git config --list set -e git checkout {branch name} git pull git status {code to edit a string in our .csproj file...} git add . git commit git tag -f dev_$todaysdate HEAD git status git push origin {branch name} dev_$todaysdate
Git配置
diff.astextplain.textconv=astextplain filter.lfs.clean=git-lfs clean -- %f filter.lfs.smudge=git-lfs smudge -- %f filter.lfs.process=git-lfs filter-process filter.lfs.required=true http.sslbackend=openssl http.sslcainfo=C:/Program Files/Git/{path} core.autocrlf=true core.fscache=true core.symlinks=true pull.rebase=false credential.helper=manager credential.https://dev.azure.com.usehttppath=true init.defaultbranch=master safe.directory=* http.sslverify=false core.repositoryformatversion=0 core.filemode=false core.bare=false core.logallrefupdates=true core.ignorecase=true remote.origin.url=https://bitbucket.org/{site}/{repo} remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* gc.auto=0 http.version=HTTP/1.1 http.https://bitbucket.org/{site}/{repo}.extraheader=AUTHORIZATION: basic ***
解决方案
1. 验证OAuth凭证有效性
- 检查Bitbucket Cloud的OAuth应用权限,确认仓库读写权限未被修改
- 重新生成OAuth令牌并更新Azure Pipelines中的服务连接,排除令牌过期或权限变更问题
2. 调整Git网络配置
- 延长Git SSL超时时间:
git config http.timeout 1200 - 强制使用HTTP/2协议:
git config http.version HTTP/2 - 清理冲突的认证头配置(当前同时存在OAuth和Basic认证,需移除Basic认证头):
git config --unset http.https://bitbucket.org/{site}/{repo}.extraheader
3. 优化构建代理环境
- 在Bash任务开头添加代理检测命令,确认是否存在自动注入的代理:
若存在代理,添加命令绕过Bitbucket的代理:echo $HTTP_PROXY echo $HTTPS_PROXYgit config --global http.https://bitbucket.org/{site}/{repo}.proxy "" - 切换至微软托管的最新代理池(如
ubuntu-latest),排除自托管代理的环境异常
4. 修复脚本语法错误
- 修正
set -e的缩进问题(原脚本缩进错误导致命令不生效):git config --list set -e git checkout {branch name}set -e需放在命令开头,确保任何命令失败时立即终止脚本
5. 临时排查Git LFS影响
- 临时禁用Git LFS,排除大文件传输导致的SSL连接中断:
若恢复正常,再针对性优化LFS传输配置git lfs uninstall
内容的提问来源于stack exchange,提问作者brpetrov
相关产品推荐
相关产品推荐

