【问题标题】:How to automate commit of code architecture to an Azure DevOps Repository?如何自动将代码架构提交到 Azure DevOps 存储库?
【发布时间】:2021-11-05 00:43:41
【问题描述】:

我正在开发一种自动化,它将根据标准和要求创建存储库和管道。为了创建存储库和管道,我使用了 Azure DevOps REST API,它运行良好。

现在,除了创建 repo 之外,还需要提交一个代码结构 - 应用程序的基本架构 - 作为初始提交。使用 Azure DevOps REST API,我可以发现我们需要逐个文件提及,并且没有批量提交选项 - Pushes - Create

我也尝试过在创建新的时分叉种子/基础仓库,但这也会将基础仓库的提交历史和仓库属性带到新的仓库中,这不是预期的。另外,forked repo 的图标是不同的,我相信它与其他 repo 的处理方式不同。

谁能指导我如何处理此要求以及如何实现它 - 自动将批量代码(基础架构)提交到新创建的存储库?

【问题讨论】:

  • 您可以使用“Azure DevOps REST API”创建存储库,并且可以使用 git cli 提交/推送。
  • 创建空的 Devops 存储库。然后在本地创建一个 repo(例如,使用模板:git init name --template dir:参见here),将新的 DevOps repo 设置为远程,然后推送,

标签: git azure-devops git-commit azure-devops-rest-api


【解决方案1】:

如评论中所述,您可以创建一个空的 Azure DevOps 存储库,然后在本地创建一个存储库,例如使用git init name --template dir

然后Set the new DevOps repo as a remote:

git remote add origin xxxxxx

然后推:

git add .   
git commit    
git push

【讨论】:

    猜你喜欢
    • 2022-01-03
    • 2022-11-15
    • 2020-05-07
    • 2019-10-18
    • 1970-01-01
    • 2022-01-04
    • 1970-01-01
    • 1970-01-01
    • 2021-04-30
    相关资源
    最近更新 更多