Azure DevOps / VSTS始终在干净的存储库中报告“已分离头”

时间:2019-02-05 06:25:56

标签: git github azure-devops

朋友

我现在对Azure DevOps / VSTS感到厌倦。詹金斯(Jenkins)更好,现在仍然如此,只是我的组织希望使用Azure DevOps。

我有一个谜需要解决。

以下是我从笔记本电脑中回购的东西,它没有未跟踪或未提交的更改。

git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

git remote -v
origin  https://github.com/xxx/terraformvsts.git (fetch)
origin  https://github.com/xxx/terraformvsts.git (push)

猜猜是什么,Azure Devops总是抱怨在每次生成执行时都具有“ DETACHED HEAD”。

在“结帐”阶段注意以下几点:

2019-02-05T05:55:33.2076875Z Note: checking out 'aad90fceecf39a7731c356ebfe2b547ddbce99e6'.
2019-02-05T05:55:33.2076992Z 
2019-02-05T05:55:33.2077872Z You are in 'detached HEAD' state. You can look around, make experimental
2019-02-05T05:55:33.2077939Z changes and commit them, and you can discard any commits you make in this
2019-02-05T05:55:33.2078179Z state without impacting any branches by performing another checkout.
2019-02-05T05:55:33.2078345Z 
2019-02-05T05:55:33.2078389Z If you want to create a new branch to retain commits you create, you may
2019-02-05T05:55:33.2078683Z do so (now or later) by using -b with the checkout command again. Example:
2019-02-05T05:55:33.2078717Z 
2019-02-05T05:55:33.2078933Z   git checkout -b <new-branch-name>
2019-02-05T05:55:33.2078966Z 
2019-02-05T05:55:33.2079004Z HEAD is now at aad90fc Clean Repository

Build管道的结帐阶段如下:

enter image description here

如何解决此问题?我不应该结帐吗?还是应该修改“构建”管道中的配置设置之一?

2 个答案:

答案 0 :(得分:7)

这是Azure DevOps管道的设计方式。

如果您仍然需要检出“那个”分支(或任何其他特定分支),则可以添加任务:

- task: CmdLine@2
  displayName: Checkout $(Build.SourceBranchName)
  inputs:
    script: 'git checkout $(Build.SourceBranchName)'

答案 1 :(得分:3)

这并不是在抱怨,这就是Azure DevOps的工作方式。我在所有构建中看到所有回购。没有错。