卡在executing command时应调process-timeout,因其专控git clone等子进程超时,默认300秒,建议设为1200秒;http.timeout对此无效。

Composer拉取子模块卡在Executing command时该调哪个超时
子模块(比如 Git 仓库、私有包、type: git 依赖)不是走 HTTP 下载 ZIP,而是调用系统 git clone 或 svn export 等命令,这类操作被归为“外部子进程”,http-basic-timeout 完全不生效,必须靠 process-timeout 控制。
常见现象是日志停在:Executing command (CWD: /path): git clone --no-checkout 'https://xxx.git' '/path/vendor/xxx',然后不动超过 5 分钟——这就是 process-timeout 触发了默认 300 秒限制。
-
process-timeout是唯一能管住git clone、unzip、php artisan这类子进程的配置,单位秒,建议设为1200(20 分钟)起步 - 临时生效:加
--timeout=1200参数,如composer install --timeout=1200 - 永久生效:运行
composer config -g process-timeout 1200,写入全局配置 - 环境变量更优先:
COMPOSER_PROCESS_TIMEOUT=1200会覆盖所有配置项,CI 中推荐用这个
Git 子模块本身超时或卡死怎么办
Composer 只负责起 git 命令,但真正卡住的可能是 Git 自身:DNS 解析慢、SSH 认证挂起、HTTPS 握手卡在代理、或 GitHub API 限流。这时候调 Composer 超时只是“等得更久”,没解决根本问题。
围绕关键发现、作用机制、临床相关性及研究局限性展开讨论。适用于撰写或优化任何生物医学论文的“讨论(Discussion)”部分——包括结果解读、与既往文献关联、阐释意外发现、界定研究局限性,以及撰写结论。当用户输入以下任一指令时也会自动触发该功能: - “write my discussion” - “help me discuss my findings” - “how do I compare to prior studies” - “write the limitations par
- 强制 Git 走 HTTPS(避开 SSH 认证):
composer config -g github-protocols https - 给 Git 加连接级超时(Linux/macOS):
git config --global core.sshCommand "timeout 300 ssh" - 配 GitHub Token 防 API 限流:在
~/.composer/auth.json里加{"github-oauth": {"github.com": "xxx"}},Token 需带repo权限 - 检查是否用了
git@地址却没配 SSH key——换成https://URL 更稳定
为什么换国内镜像对子模块无效
镜像源(如阿里云 https://mirrors.aliyun.com/composer/)只加速 Packagist 公共包的 dist ZIP 下载,对 type: git、type: svn、type: path 这类 VCS 依赖完全不代理——它们仍直连 GitHub/GitLab/自建 Git 服务器。
- 项目里若有
"repositories": [{"type": "vcs", "url": "git@xxx"}],镜像不会介入,超时风险仍在 - 私有 GitLab 仓库需确保网络可达,且
git clone命令在终端能手动跑通 - Windows 上若子模块路径含长路径或符号链接,可能触发 NTFS 权限阻塞,此时
process-timeout再大也卡住
CI 环境下拉子模块失败的隐藏雷区
CI 容器常禁用交互、限制资源、清空 home 目录,导致 Git 凭据、SSH 配置、Composer auth.json 全丢失,表面是超时,实则是认证失败后无限等待。
- 务必在 CI 脚本开头显式设置:
export COMPOSER_PROCESS_TIMEOUT=1200 - 确认
~/.composer/auth.json已注入(GitHub Token / GitLab Private Token) - 避免
--prefer-source:它强制走git clone,比--prefer-dist更易卡;CI 中应默认加--prefer-dist - WSL2 或 Docker for Mac 用户注意:宿主机 DNS 配置未透传进容器时,
git clone会卡在解析阶段,和 timeout 无关,要查/etc/resolv.conf
process-timeout 很容易掩盖真实故障点,动手前先跑 composer install -vvv 看最后一行输出,再决定是改超时、换协议,还是补凭证。










