lea*_*ner 4 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)
Run Code Online (Sandbox Code Playgroud)
你猜怎么着,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
Run Code Online (Sandbox Code Playgroud)
构建管道的结帐阶段如下所示:
如何解决这个问题?我不应该结帐吗?或者应该修改构建管道中的配置设置之一?
这就是 Azure DevOps Pipelines 的设计方式。
如果您仍然需要结帐“那个”分支(或任何其他特定分支),您可以添加一个任务:
- task: CmdLine@2
displayName: Checkout $(Build.SourceBranchName)
inputs:
script: 'git checkout $(Build.SourceBranchName)'
Run Code Online (Sandbox Code Playgroud)
小智 5
让我们区分一下这些问题。
=================================================== ========
steps:
- checkout: self
clean: true
persistCredentials: true
- script: |
git fetch --all
git switch $(basename $(Build.SourceBranch))
Run Code Online (Sandbox Code Playgroud)
=================================================== ========
其他理想的设置可能包括:
git config --local user.email "username@example.com"
git config --local user.name "User Name"
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3541 次 |
最近记录: |