从ADO repo引用GitHub repo中的外部代码

编程入门 行业动态 更新时间:2024-10-28 04:28:46
本文介绍了从ADO repo引用GitHub repo中的外部代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有2个存储库-1个ADO&1个GitHub:

I have 2 repositories - 1 ADO & 1 GitHub:

ADO回购包含内部代码

ADO repo contains internal code

GitHub存储库包含外部代码

GitHub repo contains external code

我正在使用 docs.microsoft/zh-cn/azure/devops/pipelines/repos/multi-repo-checkout?view=azure-devops 来检出上述存储库.

I'm using docs.microsoft/en-us/azure/devops/pipelines/repos/multi-repo-checkout?view=azure-devops to checkout the above repositories.

我需要使用GitHub存储库中的一些代码文件来构建ADO存储库中的代码(这意味着ADO存储库中的内部代码依赖于外部代码GitHub存储库).

I need to use some code files in GitHub repo to build the code in ADO repo (meaning internal code in ADO repo has dependency to external code GitHub repo).

示例

<ADO repo> <ADO-code-file> <content>: private readonly IXYZ _log = null; <GitHub repo> <GitHub-code-file>: IXYZ.cs <content>: public interface IXYZ { }

在ADO存储库中构建内部代码

build for internal code in ADO repo

private readonly IXYZ _log = null;

现在失败了,因为IXYZ.cs是GitHub存储库的一部分.

is failing now because IXYZ.cs is a part of GitHub repository.

是否可以从ADO repo引用GitHub repo中的外部代码?

Is it possible to refer to the external code in GitHub repo from ADO repo?

推荐答案

它可以引用公共存储库(GitHub)作为Azure DevOps Git存储库中的子模块.

It's able to refer a public repo (GitHub) as submodule in Azure DevOps Git Repo.

选择是否要从子模块下载文件.你可以选择获取直接子模块或嵌套到任何子模块的所有子模块递归深度.如果要对子模块使用LFS,请确保请参阅有关将LFS与子模块一起使用的说明.

Select if you want to download files from submodules. You can either choose to get the immediate submodules or all submodules nested to any depth of recursion. If you want to use LFS with submodules, be sure to see the note about using LFS with submodules.

构建管道将检出您的Git子模块,只要它们是:

The build pipeline will check out your Git submodules as long as they are:

  • 未经身份验证的:未经身份验证的公共回购,不需要克隆或获取凭据.
  • 已认证:与上面指定的Git存储库包含在同一项目,GitHub组织或Bitbucket Cloud帐户中.

通过使用相对于主存储库的URL添加.例如,将签出该代码: git submodule add/../../submodule.git mymodule 不会签出此代码: git子模块add dev.azure/fabrikamfiber/_git/ConsoleApp mymodule

Added by using a URL relative to the main repository. For example, this one would be checked out: git submodule add /../../submodule.git mymodule This one would not be checked out: git submodule add dev.azure/fabrikamfiber/_git/ConsoleApp mymodule

示例供您参考:

[submodule "DBPkg"] path = DBPkg url = ../DBPkg

您还可以检查以下链接: stackoverflow/a/34618962/5391065

You could also check this link: stackoverflow/a/34618962/5391065

更多推荐

从ADO repo引用GitHub repo中的外部代码

本文发布于:2023-07-04 17:27:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1027081.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:代码   ADO   repo   GitHub

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!