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

Azure DevOps TF401019跨项目Git子模块权限问题解决

Azure DevOps跨项目拉取Git子模块遇TF401019错误的解决方法

问题描述

本地拉取跨项目Git子模块一切正常,但Azure DevOps流水线执行时抛出权限错误:
remote: TF401019: The Git repository with name or identifier Repo456 does not exist or you do not have permissions for the operation you are attempting.

已尝试的排查操作

  • 关闭非发布流水线的「限制作业授权范围为当前项目」设置
  • 关闭发布流水线的「限制作业授权范围为当前项目」设置
  • 关闭YAML流水线的「保护仓库访问权限」设置
  • 将ProjectA Build Service添加到ProjectB的Contributors和/或Readers角色
  • 将ProjectA使用的Agent Pool Service添加到ProjectB的Contributors和/或Readers角色
  • 在流水线YAML配置的构建步骤中,将默认代理池设置为ProjectA使用的Agent Pool Service
  • 勾选流水线YAML配置>获取源>拉取子模块选项

仓库与配置信息

  • 主仓库:Org/ProjectA/_git/Repo123
  • 子模块仓库:Org/ProjectB/_git/Repo456

尝试过两种.gitmodules配置:
第一种配置:

[submodule "plugins/MyModule"]
path = plugins/MyModule
url = https://ORG@dev.azure.com/Org/ProjectB/_git/Repo456

第二种配置:

[submodule "plugins/MyModule"]
path = plugins/MyModule
url = ../../ProjectA/Repo456

最终解决方案

只需完成以下操作即可解决问题:

  1. 将具备对应权限的用户添加到子模块仓库(ProjectB/Repo456)的权限列表中
  2. 关闭非发布流水线的「限制作业授权范围为当前项目」设置,同时关闭YAML流水线的「保护仓库访问权限」设置

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.25 09:01:11