GitVersion.exe错误:LibGit2Sharp.NameConflictException:具有该名称的引用已存在

时间:2019-07-16 07:25:48

标签: git batch-file bitbucket teamcity devops

我们正在使用带有以下代码的bat文件。

REM Initialize Gitflow and update Version details for assembly info.
REM Usuage Gitflowinitialization.bat 

set arg1=%1
cd..
REM git fetch --prune
git add .
git commit -m "Untracked Changes"
git flow init -d -f
GitVersion.exe /updateassemblyinfo %arg1%
GitVersion.exe . /output buildserver /l GitVersion.log

遇到错误。

Hooks and filters directory? [D:/BuildAgent1/work/5ec585e41e1957db/.git/hooks] 
[06:18:24][Step 1/19] INFO [07/11/19 6:18:24:74] Working directory: D:\BuildAgent1\work\5ec585e41e1957db
[06:18:24][Step 1/19] INFO [07/11/19 6:18:24:75] IsDynamicGitRepository: False
[06:18:24][Step 1/19] INFO [07/11/19 6:18:24:77] Returning Project Root from DotGitDirectory: D:\BuildAgent1\work\5ec585e41e1957db\.git - D:\BuildAgent1\work\5ec585e41e1957db
[06:18:24][Step 1/19] INFO [07/11/19 6:18:24:77] Running on Windows.
[06:18:24][Step 1/19] INFO [07/11/19 6:18:24:77] Applicable build agent found: 'TeamCity'.
[06:18:24][Step 1/19] INFO [07/11/19 6:18:24:78] Branch from build environment: refs/heads/bugfix/US63792-PICommon-Package-Update
[06:18:24][Step 1/19] INFO [07/11/19 6:18:24:78] Begin: Normalizing git directory for branch 'refs/heads/bugfix/US63792-PICommon-Package-Update'
[06:18:24][Step 1/19] INFO [07/11/19 6:18:24:84] One remote found (origin -> 'ssh://git@bitbucket-prod.pii.pxl.int:7999/pco/parexel-core-services-patient.git').
[06:18:24][Step 1/19] INFO [07/11/19 6:18:24:85] Skipping fetching, if GitVersion does not calculate your version as expected you might need to allow fetching or use dynamic repositories
[06:18:24][Step 1/19] INFO [07/11/19 6:18:24:86] Creating local branch refs/heads/bugfix/US63792-PICommon-Package-Update
[06:18:24][Step 1/19] INFO [07/11/19 6:18:24:87] End: Normalizing git directory for branch 'refs/heads/bugfix/US63792-PICommon-Package-Update' (Took: 94.31ms)
[06:18:24][Step 1/19] ERROR [07/11/19 6:18:24:87] An unexpected error occurred:
[06:18:24][Step 1/19] LibGit2Sharp.NameConflictException: failed to write reference 'refs/heads/bugfix/US63792-PICommon-Package-Update': a reference with that name already exists.
[06:18:24][Step 1/19] at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
[06:18:24][Step 1/19] at LibGit2Sharp.Core.Proxy.git_reference_create(RepositoryHandle repo, String name, ObjectId targetId, Boolean allowOverwrite, String logMessage)
[06:18:24][Step 1/19] at LibGit2Sharp.ReferenceCollection.Add(String name, ObjectId targetId, String logMessage, Boolean allowOverwrite)
[06:18:24][Step 1/19] at LibGit2Sharp.ReferenceCollection.Add(String name, ObjectId targetId)
[06:18:24][Step 1/19] at GitVersion.GitRepositoryHelper.EnsureLocalBranchExistsForCurrentBranch(Repository repo, Remote remote, String currentBranch)
[06:18:24][Step 1/19] at GitVersion.GitRepositoryHelper.NormalizeGitDirectory(String gitDirectory, AuthenticationInfo authentication, Boolean noFetch, String currentBranch)
[06:18:24][Step 1/19] at GitVersion.GitPreparer.Initialise(Boolean normaliseGitDirectory, String currentBranch, Boolean shouldCleanUpRemotes)
[06:18:24][Step 1/19] at GitVersion.ExecuteCore.ExecuteGitVersion(String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId, Config overrideConfig, Boolean noCache)
[06:18:24][Step 1/19] at GitVersion.SpecifiedArgumentRunner.Run(Arguments arguments, IFileSystem fileSystem)
[06:18:24][Step 1/19] at GitVersion.Program.VerifyArgumentsAndRun()

0 个答案:

没有答案