You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Pipeline两次Checkout任务出现仓库移动复用警告问题排查

解决Azure Pipeline多Checkout任务的移动仓库警告问题

问题原因

你配置的两个Checkout任务中,若第二个任务指向的self仓库与第一个任务的${{ parameters.repository_resource }}是同一仓库,Azure Pipeline会尝试复用已克隆的仓库目录,将其移动到你指定的mydirectory路径。但由于文件占用、权限限制或路径冲突等原因,移动操作失败,从而触发警告。即便流水线最终会重新克隆仓库完成任务,警告仍会持续出现。

解决方案

方案1:强制清理并重新克隆

给第二个Checkout任务添加clean: true参数,强制在checkout前清理目标路径并重新克隆仓库,跳过复用已有目录的逻辑:

- checkout: ${{ parameters.repository_resource }}
  displayName: checkout ${{ parameters.repository_resource }}
  path: 's'

- checkout: self
  displayName: checkout repository
  path: "mydirectory"
  clean: true

方案2:避免复用同一仓库的多次Checkout

如果两个任务实际拉取的是同一仓库,完全可以合并为一次Checkout,或者只保留需要的路径:

- checkout: self
  displayName: checkout repository
  path: "mydirectory"

方案3:调整路径避免冲突

第一个任务使用的path: 's'是Azure Pipeline默认的self仓库路径,若第二个任务拉取的是不同仓库,可修改第一个任务的路径,避免与默认路径混淆:

- checkout: ${{ parameters.repository_resource }}
  displayName: checkout ${{ parameters.repository_resource }}
  path: 'external-repo'

- checkout: self
  displayName: checkout repository
  path: "mydirectory"

内容的提问来源于stack exchange,提问作者Conal Sparrow

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.16 20:10:02