GitVersion: Gitversion crashes on teamcity when there is no local master branch

Info: We are using gitlab and teamcity. Both are not publicly visible from internet. They are only visible inside our company network. Therefore they only have self-signed certificates to operate. We had to disable ssl to use them with git. And because of this, we can’t use dynamic repository with GitVersion. We are already using teamcity.git.fetchAllHeads=true

The problem is like this: When we run teamcity build with option to clear working directory (empty the build folder before building) teamcity then fetches all remote branches and also the current feature branch that is building. Because of clean working directory, there is no local master branch, only origin/master. And this results in crash of gitversion. (more info in log below) The hot fix for this is to run that build configuration for master branch and then not deleting working directory => then there exists local master branch => gitversion works. But everytime someone would want to clear working directory when building any non-master branch, it will crash.

I’m not quite sure, why gitversion can’t infer master branch from that origin/master. I really don’t understand why this is happening.

Thanks

Build logs:

[Step 1/1] Running: C:\ProgramData\chocolatey\bin\gitversion.exe "C:\BuildAgent\work\da7b98356013a858" /output "buildserver" /UpdateAssemblyInfo /EnsureAssemblyInfo /nonormalize
[21:29:01]	[Step 1/1] INFO [12/04/19 21:29:01:49] Working directory: C:\BuildAgent\work\da7b98356013a858
[21:29:01]	[Step 1/1] INFO [12/04/19 21:29:01:50] IsDynamicGitRepository: False
[21:29:01]	[Step 1/1] INFO [12/04/19 21:29:01:54] Returning Project Root from DotGitDirectory: C:\BuildAgent\work\da7b98356013a858\.git\ - C:\BuildAgent\work\da7b98356013a858\
[21:29:01]	[Step 1/1] INFO [12/04/19 21:29:01:54] Running on Windows.
[21:29:01]	[Step 1/1] INFO [12/04/19 21:29:01:54] Applicable build agent found: 'TeamCity'.
[21:29:01]	[Step 1/1] INFO [12/04/19 21:29:01:54] Branch from build environment: refs/heads/feature/test-build
[21:29:01]	[Step 1/1] INFO [12/04/19 21:29:01:54] Project root is: C:\BuildAgent\work\da7b98356013a858\
[21:29:01]	[Step 1/1] INFO [12/04/19 21:29:01:54] DotGit directory is: C:\BuildAgent\work\da7b98356013a858\.git
[21:29:03]	[Step 1/1] INFO [12/04/19 21:29:04:00] Begin: Loading version variables from disk cache
[21:29:03]	[Step 1/1]   INFO [12/04/19 21:29:04:00] Cache file C:\BuildAgent\work\da7b98356013a858\.git\gitversion_cache\41564CAF7CB9825C80F67B0898584EEB07738967.yml not found.
[21:29:03]	[Step 1/1]   INFO [12/04/19 21:29:04:00] End: Loading version variables from disk cache (Took: 2.13ms)
[21:29:04]	[Step 1/1]   INFO [12/04/19 21:29:04:09] Using latest commit on specified branch
[21:29:04]	[Step 1/1]   INFO [12/04/19 21:29:04:11] Begin: Attempting to inherit branch configuration from parent branch
[21:29:09]	[Step 1/1]     INFO [12/04/19 21:29:09:35] Begin: Finding branch source of 'feature/test-build'
[21:29:11]	[Step 1/1]     INFO [12/04/19 21:29:11:97] End: Finding branch source of 'feature/test-build' (Took: 2,620.66ms)
[21:29:11]	[Step 1/1]     INFO [12/04/19 21:29:11:98] Begin: Getting branches containing the commit '74e32ff76799d1bb895e965c2598f964c09b8bc6'.
[21:29:11]	[Step 1/1]       INFO [12/04/19 21:29:11:98] Trying to find direct branches.
[21:29:11]	[Step 1/1]       INFO [12/04/19 21:29:11:98] No direct branches found, searching through tracked branches.
[21:29:11]	[Step 1/1]       INFO [12/04/19 21:29:11:98] Searching for commits reachable from 'origin/master'.
[21:29:12]	[Step 1/1]       INFO [12/04/19 21:29:12:46] The branch 'origin/master' has no matching commits.
[21:29:12]	[Step 1/1]       INFO [12/04/19 21:29:12:46] Searching for commits reachable from 'origin/release/2.23.21149_SP3'.
[21:29:12]	[Step 1/1]       INFO [12/04/19 21:29:12:62] The branch 'origin/release/2.23.21149_SP3' has no matching commits.
[21:29:12]	[Step 1/1]       INFO [12/04/19 21:29:12:62] Searching for commits reachable from 'origin/release/2.24.18053.x_stable'.
[21:29:12]	[Step 1/1]       INFO [12/04/19 21:29:12:80] The branch 'origin/release/2.24.18053.x_stable' has no matching commits.
[21:29:12]	[Step 1/1]       INFO [12/04/19 21:29:12:80] Searching for commits reachable from 'origin/release/2.26.21063.x_stable'.
[21:29:12]	[Step 1/1]       INFO [12/04/19 21:29:13:00] The branch 'origin/release/2.26.21063.x_stable' has no matching commits.
[21:29:12]	[Step 1/1]       INFO [12/04/19 21:29:13:00] Searching for commits reachable from 'origin/release/2.27.23413.x_stable'.
[21:29:13]	[Step 1/1]       INFO [12/04/19 21:29:13:21] The branch 'origin/release/2.27.23413.x_stable' has no matching commits.
[21:29:13]	[Step 1/1]       INFO [12/04/19 21:29:13:21] Searching for commits reachable from 'origin/release/2.27.27280.SP2_database_switch'.
[21:29:13]	[Step 1/1]       INFO [12/04/19 21:29:13:45] The branch 'origin/release/2.27.27280.SP2_database_switch' has no matching commits.
[21:29:13]	[Step 1/1]       INFO [12/04/19 21:29:13:45] Searching for commits reachable from 'origin/release/2.28.28235.x_stable'.
[21:29:13]	[Step 1/1]       INFO [12/04/19 21:29:13:73] The branch 'origin/release/2.28.28235.x_stable' has no matching commits.
[21:29:13]	[Step 1/1]       INFO [12/04/19 21:29:13:73] Searching for commits reachable from 'origin/release/2.29.28235.0_NETConsult'.
[21:29:13]	[Step 1/1]       INFO [12/04/19 21:29:14:01] The branch 'origin/release/2.29.28235.0_NETConsult' has no matching commits.
[21:29:13]	[Step 1/1]       INFO [12/04/19 21:29:14:01] Searching for commits reachable from 'origin/release/2.30.32159.x_stable'.
[21:29:14]	[Step 1/1]       INFO [12/04/19 21:29:14:29] The branch 'origin/release/2.30.32159.x_stable' has no matching commits.
[21:29:14]	[Step 1/1]       INFO [12/04/19 21:29:14:29] Searching for commits reachable from 'origin/release/2.31.35662.x_stable'.
[21:29:14]	[Step 1/1]       INFO [12/04/19 21:29:14:60] The branch 'origin/release/2.31.35662.x_stable' has no matching commits.
[21:29:14]	[Step 1/1]       INFO [12/04/19 21:29:14:60] Searching for commits reachable from 'origin/release/2.32.36549.x_stable'.
[21:29:14]	[Step 1/1]       INFO [12/04/19 21:29:14:92] The branch 'origin/release/2.32.36549.x_stable' has no matching commits.
[21:29:14]	[Step 1/1]     INFO [12/04/19 21:29:14:92] End: Getting branches containing the commit '74e32ff76799d1bb895e965c2598f964c09b8bc6'. (Took: 2,940.45ms)
[21:29:14]	[Step 1/1]     INFO [12/04/19 21:29:14:92] Found possible parent branches: 
[21:29:17]	[Step 1/1]   INFO [12/04/19 21:29:17:41] End: Attempting to inherit branch configuration from parent branch (Took: 13,305.71ms)
[21:29:17]	[Step 1/1]   INFO [12/04/19 21:29:17:47] 
[21:29:17]	[Step 1/1]   ERROR [12/04/19 21:29:17:47] An unexpected error occurred:
[21:29:17]	[Step 1/1]   INFO [12/04/19 21:29:17:47] Attempting to show the current git graph (please include in issue): 
[21:29:17]	[Step 1/1] System.InvalidOperationException: Could not find a 'develop' or 'master' branch, neither locally nor remotely.
[21:29:17]	[Step 1/1]   INFO [12/04/19 21:29:17:47] Showing max of 100 commits
[21:29:17]	[Step 1/1]    at GitVersion.Configuration.BranchConfigurationCalculator.InheritBranchConfiguration(Branch targetBranch, BranchConfig branchConfiguration, IList`1 excludedInheritBranches)
[21:29:17]	[Step 1/1]    at GitVersion.Configuration.BranchConfigurationCalculator.GetBranchConfiguration(Branch targetBranch, IList`1 excludedInheritBranches)
[21:29:17]	[Step 1/1]    at GitVersion.GitVersionContext.CalculateEffectiveConfiguration()
[21:29:17]	[Step 1/1]    at GitVersion.GitVersionContext..ctor(IRepository repository, ILog log, Branch currentBranch, Config configuration, Boolean onlyEvaluateTrackedBranches, String commitId)
[21:29:17]	[Step 1/1]    at GitVersion.GitVersionContext..ctor(IRepository repository, ILog log, String targetBranch, Config configuration, Boolean onlyEvaluateTrackedBranches, String commitId)
[21:29:17]	[Step 1/1]    at GitVersion.GitVersionCalculator.<>c__DisplayClass14_0.<ExecuteInternal>b__0(IRepository repo)
[21:29:17]	[Step 1/1]    at GitVersion.Extensions.LibGitExtensions.WithRepository[TResult](String dotGitDirectory, Func`2 action)
[21:29:17]	[Step 1/1]    at GitVersion.GitVersionCalculator.ExecuteInternal(String targetBranch, String commitId, Config overrideConfig)
[21:29:17]	[Step 1/1]    at GitVersion.GitVersionCalculator.GetCachedGitVersionInfo(String targetBranch, String commitId, Config overrideConfig, Boolean noCache)
[21:29:17]	[Step 1/1]    at GitVersion.GitVersionCalculator.CalculateVersionVariables()
[21:29:17]	[Step 1/1]    at GitVersion.ExecCommand.Execute()
[21:29:17]	[Step 1/1]    at GitVersion.GitVersionExecutor.VerifyArgumentsAndRun(Arguments arguments)
[21:29:21]	[Step 1/1]   INFO [12/04/19 21:29:21:95] * 74e32ff767 2 minutes ago  (HEAD -> feature/test-build, origin/feature/test-build)
[21:29:21]	[Step 1/1] | * 0dcafcbecc 5 hours ago  (origin/feature/CP-16166-TabulkaPrav, feature/CP-16166-TabulkaPrav)
[21:29:21]	[Step 1/1] | * fdd8952d87 6 hours ago 
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] | * 5e047364b8 6 hours ago  (origin/feature/wcf_proxies, feature/wcf_proxies)
[21:29:21]	[Step 1/1] | * d701c59f9e 6 hours ago 
[21:29:21]	[Step 1/1] | * 715b2e4e5e 6 hours ago 
[21:29:21]	[Step 1/1] | * 7440fc8553 6 hours ago 
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] * a424836be6 9 hours ago  (origin/master)
[21:29:21]	[Step 1/1] * 3def059942 12 hours ago 
[21:29:21]	[Step 1/1] | * 500de36c73 12 hours ago  (origin/feature/CP-16188)
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] * 15980fb559 14 hours ago 
[21:29:21]	[Step 1/1] * 22337d9adc 14 hours ago 
[21:29:21]	[Step 1/1] * 4114fd1008 30 hours ago 
[21:29:21]	[Step 1/1] * 8c443c6e10 31 hours ago 
[21:29:21]	[Step 1/1] * cff67b3105 32 hours ago 
[21:29:21]	[Step 1/1] * 4cd846438a 33 hours ago 
[21:29:21]	[Step 1/1] * a29d331302 2 days ago  (origin/feature/cp-16159-wcf-dospecifikace)
[21:29:21]	[Step 1/1] | * bb0880d728 2 days ago  (origin/feature/cp-16218-restfixdemo)
[21:29:21]	[Step 1/1] | * 8c1fa70a6b 2 days ago 
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] | * 60a24349c1 2 days ago  (origin/feature/CP-16249)
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] *   f856734baa 2 days ago 
[21:29:21]	[Step 1/1] |\  
[21:29:21]	[Step 1/1] | * 38264dec69 2 days ago 
[21:29:21]	[Step 1/1] | * d6fdb56358 2 days ago 
[21:29:21]	[Step 1/1] | * 918ccaef21 2 days ago 
[21:29:21]	[Step 1/1] | * 51f6a70552 2 days ago 
[21:29:21]	[Step 1/1] | * c15451e853 2 days ago 
[21:29:21]	[Step 1/1] | * 9955513835 2 days ago 
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] *   5f978bbd7a 2 days ago 
[21:29:21]	[Step 1/1] |\  
[21:29:21]	[Step 1/1] | * 651f6f0ad6 2 days ago 
[21:29:21]	[Step 1/1] | * be70223f43 2 days ago 
[21:29:21]	[Step 1/1] | * a631a31f13 2 days ago 
[21:29:21]	[Step 1/1] | * ee0a425d1a 2 days ago 
[21:29:21]	[Step 1/1] | * 6c43de6a96 2 days ago 
[21:29:21]	[Step 1/1] | * 7dcab60967 2 days ago 
[21:29:21]	[Step 1/1] | * 71d8ae3feb 2 days ago 
[21:29:21]	[Step 1/1] | * 8b8041dc35 2 days ago 
[21:29:21]	[Step 1/1] | * 3e79f08a67 2 days ago 
[21:29:21]	[Step 1/1] | * d579a35c1e 2 days ago 
[21:29:21]	[Step 1/1] | * 3cb444932a 2 days ago 
[21:29:21]	[Step 1/1] | * d7451f7ed5 2 days ago 
[21:29:21]	[Step 1/1] | * 29f887b57b 2 days ago 
[21:29:21]	[Step 1/1] | * a5a2d76880 2 days ago 
[21:29:21]	[Step 1/1] | * 5b4d4e9807 2 days ago 
[21:29:21]	[Step 1/1] | * 75ae3fdeab 2 days ago 
[21:29:21]	[Step 1/1] | * ada6549d64 2 days ago 
[21:29:21]	[Step 1/1] | * a4c21967c2 2 days ago 
[21:29:21]	[Step 1/1] | * eb9856cf2c 2 days ago 
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] *   b7188226b2 3 days ago 
[21:29:21]	[Step 1/1] |\  
[21:29:21]	[Step 1/1] | * 70db63f741 3 days ago 
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] * 95e2209982 3 days ago 
[21:29:21]	[Step 1/1] *   1e9c5368a1 3 days ago 
[21:29:21]	[Step 1/1] |\  
[21:29:21]	[Step 1/1] | * 38202d0c3e 5 days ago 
[21:29:21]	[Step 1/1] | * 62898a0d73 5 days ago 
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] * 6b36cdc841 6 days ago 
[21:29:21]	[Step 1/1] *   61055d6704 6 days ago 
[21:29:21]	[Step 1/1] |\  
[21:29:21]	[Step 1/1] | * c858130961 6 days ago 
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] * 3222822fbe 6 days ago 
[21:29:21]	[Step 1/1] * d02e072d31 7 days ago 
[21:29:21]	[Step 1/1] * 52099c2dc8 7 days ago 
[21:29:21]	[Step 1/1] * 98e1e1c045 7 days ago 
[21:29:21]	[Step 1/1] * 245bb2b7b4 7 days ago 
[21:29:21]	[Step 1/1] * b9faa34aa5 7 days ago 
[21:29:21]	[Step 1/1] * 4ce69dec97 8 days ago 
[21:29:21]	[Step 1/1] * 8082475d27 8 days ago 
[21:29:21]	[Step 1/1] * 6f675c6414 8 days ago 
[21:29:21]	[Step 1/1] * fc64e9cddb 8 days ago 
[21:29:21]	[Step 1/1] | * 15db6eaf76 3 days ago  (origin/feature/CPD-971-integrateIEcgDiagGreenToPink)
[21:29:21]	[Step 1/1] | * 92d03b3e21 3 days ago 
[21:29:21]	[Step 1/1] | * b6f30d28e5 3 days ago 
[21:29:21]	[Step 1/1] | * 3aa5a208c5 3 days ago 
[21:29:21]	[Step 1/1] | * feacd73d96 3 days ago 
[21:29:21]	[Step 1/1] | * 8c5b70c4aa 3 days ago 
[21:29:21]	[Step 1/1] | * f59b3ecd9c 3 days ago 
[21:29:21]	[Step 1/1] | * 4a79b4443c 3 days ago 
[21:29:21]	[Step 1/1] | * 3b804f5d4e 3 days ago 
[21:29:21]	[Step 1/1] | * f49684621d 3 days ago 
[21:29:21]	[Step 1/1] | * 9f1647b7be 3 days ago 
[21:29:21]	[Step 1/1] | * debd521ab5 3 days ago 
[21:29:21]	[Step 1/1] | * 295fbaf941 3 days ago 
[21:29:21]	[Step 1/1] | * 05a1d58d03 3 days ago 
[21:29:21]	[Step 1/1] | * bc47b72136 9 days ago 
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] * 4daa6054e5 9 days ago 
[21:29:21]	[Step 1/1] * 1e39c64631 9 days ago 
[21:29:21]	[Step 1/1] * 363f9c9b68 9 days ago 
[21:29:21]	[Step 1/1] * e38a7da34f 9 days ago 
[21:29:21]	[Step 1/1] * 69dc4a8414 9 days ago 
[21:29:21]	[Step 1/1] * 8eb18d2480 9 days ago 
[21:29:21]	[Step 1/1] * 636f06acac 9 days ago 
[21:29:21]	[Step 1/1] * 963e82bf09 9 days ago 
[21:29:21]	[Step 1/1] *   956abce4ae 9 days ago 
[21:29:21]	[Step 1/1] |\  
[21:29:21]	[Step 1/1] | * c70101a46a 9 days ago 
[21:29:21]	[Step 1/1] | * 902663d538 9 days ago 
[21:29:21]	[Step 1/1] | * 1c111f7619 9 days ago 
[21:29:21]	[Step 1/1] | * 2e891b39d7 9 days ago 
[21:29:21]	[Step 1/1] | * a780ab0a5c 9 days ago 
[21:29:21]	[Step 1/1] | * 2d567e48aa 9 days ago 
[21:29:21]	[Step 1/1] | * 746d854e4b 9 days ago 
[21:29:21]	[Step 1/1] | * a251dcbc81 9 days ago 
[21:29:21]	[Step 1/1] | * 3e0ef21402 9 days ago 
[21:29:21]	[Step 1/1] | * c328de24bb 9 days ago 
[21:29:21]	[Step 1/1] 
[21:29:21]	[Step 1/1] INFO [12/04/19 21:29:01:49] Applicable build agent found: 'TeamCity'.INFO [12/04/19 21:29:01:49] Working directory: C:\BuildAgent\work\da7b98356013a858INFO [12/04/19 21:29:01:50] IsDynamicGitRepository: FalseINFO [12/04/19 21:29:01:54] Returning Project Root from DotGitDirectory: C:\BuildAgent\work\da7b98356013a858\.git\ - C:\BuildAgent\work\da7b98356013a858\INFO [12/04/19 21:29:01:54] Running on Windows.INFO [12/04/19 21:29:01:54] Applicable build agent found: 'TeamCity'.INFO [12/04/19 21:29:01:54] Branch from build environment: refs/heads/feature/test-buildINFO [12/04/19 21:29:01:54] Project root is: C:\BuildAgent\work\da7b98356013a858\INFO [12/04/19 21:29:01:54] DotGit directory is: C:\BuildAgent\work\da7b98356013a858\.gitINFO [12/04/19 21:29:04:00] Begin: Loading version variables from disk cache  INFO [12/04/19 21:29:04:00] Cache file C:\BuildAgent\work\da7b98356013a858\.git\gitversion_cache\41564CAF7CB9825C80F67B0898584EEB07738967.yml not found.  INFO [12/04/19 21:29:04:00] End: Loading version variables from disk cache (Took: 2.13ms)  INFO [12/04/19 21:29:04:09] Using latest commit on specified branch  INFO [12/04/19 21:29:04:11] Begin: Attempting to inherit branch configuration from parent branch    INFO [12/04/19 21:29:09:35] Begin: Finding branch source of 'feature/test-build'    INFO [12/04/19 21:29:11:97] End: Finding branch source of 'feature/test-build' (Took: 2,620.66ms)    INFO [12/04/19 21:29:11:98] Begin: Getting branches containing the commit '74e32ff76799d1bb895e965c2598f964c09b8bc6'.      INFO [12/04/19 21:29:11:98] Trying to find direct branches.      INFO [12/04/19 21:29:11:98] No direct branches found, searching through tracked branches.      INFO [12/04/19 21:29:11:98] Searching for commits reachable from 'origin/master'.      INFO [12/04/19 21:29:12:46] The branch 'origin/master' has no matching commits.      INFO [12/04/19 21:29:12:46] Searching for commits reachable from 'origin/release/2.23.21149_SP3'.      INFO [12/04/19 21:29:12:62] The branch 'origin/release/2.23.21149_SP3' has no matching commits.      INFO [12/04/19 21:29:12:62] Searching for commits reachable from 'origin/release/2.24.18053.x_stable'.      INFO [12/04/19 21:29:12:80] The branch 'origin/release/2.24.18053.x_stable' has no matching commits.      INFO [12/04/19 21:29:12:80] Searching for commits reachable from 'origin/release/2.26.21063.x_stable'.      INFO [12/04/19 21:29:13:00] The branch 'origin/release/2.26.21063.x_stable' has no matching commits.      INFO [12/04/19 21:29:13:00] Searching for commits reachable from 'origin/release/2.27.23413.x_stable'.      INFO [12/04/19 21:29:13:21] The branch 'origin/release/2.27.23413.x_stable' has no matching commits.      INFO [12/04/19 21:29:13:21] Searching for commits reachable from 'origin/release/2.27.27280.SP2_database_switch'.      INFO [12/04/19 21:29:13:45] The branch 'origin/release/2.27.27280.SP2_database_switch' has no matching commits.      INFO [12/04/19 21:29:13:45] Searching for commits reachable from 'origin/release/2.28.28235.x_stable'.      INFO [12/04/19 21:29:13:73] The branch 'origin/release/2.28.28235.x_stable' has no matching commits.      INFO [12/04/19 21:29:13:73] Searching for commits reachable from 'origin/release/2.29.28235.0_NETConsult'.      INFO [12/04/19 21:29:14:01] The branch 'origin/release/2.29.28235.0_NETConsult' has no matching commits.      INFO [12/04/19 21:29:14:01] Searching for commits reachable from 'origin/release/2.30.32159.x_stable'.      INFO [12/04/19 21:29:14:29] The branch 'origin/release/2.30.32159.x_stable' has no matching commits.      INFO [12/04/19 21:29:14:29] Searching for commits reachable from 'origin/release/2.31.35662.x_stable'.      INFO [12/04/19 21:29:14:60] The branch 'origin/release/2.31.35662.x_stable' has no matching commits.      INFO [12/04/19 21:29:14:60] Searching for commits reachable from 'origin/release/2.32.36549.x_stable'.      INFO [12/04/19 21:29:14:92] The branch 'origin/release/2.32.36549.x_stable' has no matching commits.    INFO [12/04/19 21:29:14:92] End: Getting branches containing the commit '74e32ff76799d1bb895e965c2598f964c09b8bc6'. (Took: 2,940.45ms)    INFO [12/04/19 21:29:14:92] Found possible parent branches:   INFO [12/04/19 21:29:17:41] End: Attempting to inherit branch configuration from parent branch (Took: 13,305.71ms)  ERROR [12/04/19 21:29:17:47] An unexpected error occurred:
[21:29:21]	[Step 1/1] System.InvalidOperationException: Could not find a 'develop' or 'master' branch, neither locally nor remotely.
[21:29:21]	[Step 1/1]    at GitVersion.Configuration.BranchConfigurationCalculator.InheritBranchConfiguration(Branch targetBranch, BranchConfig branchConfiguration, IList`1 excludedInheritBranches)
[21:29:21]	[Step 1/1]    at GitVersion.Configuration.BranchConfigurationCalculator.GetBranchConfiguration(Branch targetBranch, IList`1 excludedInheritBranches)
[21:29:21]	[Step 1/1]    at GitVersion.GitVersionContext.CalculateEffectiveConfiguration()
[21:29:21]	[Step 1/1]    at GitVersion.GitVersionContext..ctor(IRepository repository, ILog log, Branch currentBranch, Config configuration, Boolean onlyEvaluateTrackedBranches, String commitId)
[21:29:21]	[Step 1/1]    at GitVersion.GitVersionContext..ctor(IRepository repository, ILog log, String targetBranch, Config configuration, Boolean onlyEvaluateTrackedBranches, String commitId)
[21:29:21]	[Step 1/1]    at GitVersion.GitVersionCalculator.<>c__DisplayClass14_0.<ExecuteInternal>b__0(IRepository repo)
[21:29:21]	[Step 1/1]    at GitVersion.Extensions.LibGitExtensions.WithRepository[TResult](String dotGitDirectory, Func`2 action)
[21:29:21]	[Step 1/1]    at GitVersion.GitVersionCalculator.ExecuteInternal(String targetBranch, String commitId, Config overrideConfig)
[21:29:21]	[Step 1/1]    at GitVersion.GitVersionCalculator.GetCachedGitVersionInfo(String targetBranch, String commitId, Config overrideConfig, Boolean noCache)
[21:29:21]	[Step 1/1]    at GitVersion.GitVersionCalculator.CalculateVersionVariables()
[21:29:21]	[Step 1/1]    at GitVersion.ExecCommand.Execute()
[21:29:21]	[Step 1/1]    at GitVersion.GitVersionExecutor.VerifyArgumentsAndRun(Arguments arguments)  INFO [12/04/19 21:29:17:47]   INFO [12/04/19 21:29:17:47] Attempting to show the current git graph (please include in issue):   INFO [12/04/19 21:29:17:47] Showing max of 100 commits  INFO [12/04/19 21:29:21:95] * 74e32ff767 2 minutes ago  (HEAD -> feature/test-build, origin/feature/test-build)
[21:29:21]	[Step 1/1] | * 0dcafcbecc 5 hours ago  (origin/feature/CP-16166-TabulkaPrav, feature/CP-16166-TabulkaPrav)
[21:29:21]	[Step 1/1] | * fdd8952d87 6 hours ago 
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] | * 5e047364b8 6 hours ago  (origin/feature/wcf_proxies, feature/wcf_proxies)
[21:29:21]	[Step 1/1] | * d701c59f9e 6 hours ago 
[21:29:21]	[Step 1/1] | * 715b2e4e5e 6 hours ago 
[21:29:21]	[Step 1/1] | * 7440fc8553 6 hours ago 
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] * a424836be6 9 hours ago  (origin/master)
[21:29:21]	[Step 1/1] * 3def059942 12 hours ago 
[21:29:21]	[Step 1/1] | * 500de36c73 12 hours ago  (origin/feature/CP-16188)
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] * 15980fb559 14 hours ago 
[21:29:21]	[Step 1/1] * 22337d9adc 14 hours ago 
[21:29:21]	[Step 1/1] * 4114fd1008 30 hours ago 
[21:29:21]	[Step 1/1] * 8c443c6e10 31 hours ago 
[21:29:21]	[Step 1/1] * cff67b3105 32 hours ago 
[21:29:21]	[Step 1/1] * 4cd846438a 33 hours ago 
[21:29:21]	[Step 1/1] * a29d331302 2 days ago  (origin/feature/cp-16159-wcf-dospecifikace)
[21:29:21]	[Step 1/1] | * bb0880d728 2 days ago  (origin/feature/cp-16218-restfixdemo)
[21:29:21]	[Step 1/1] | * 8c1fa70a6b 2 days ago 
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] | * 60a24349c1 2 days ago  (origin/feature/CP-16249)
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] *   f856734baa 2 days ago 
[21:29:21]	[Step 1/1] |\  
[21:29:21]	[Step 1/1] | * 38264dec69 2 days ago 
[21:29:21]	[Step 1/1] | * d6fdb56358 2 days ago 
[21:29:21]	[Step 1/1] | * 918ccaef21 2 days ago 
[21:29:21]	[Step 1/1] | * 51f6a70552 2 days ago 
[21:29:21]	[Step 1/1] | * c15451e853 2 days ago 
[21:29:21]	[Step 1/1] | * 9955513835 2 days ago 
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] *   5f978bbd7a 2 days ago 
[21:29:21]	[Step 1/1] |\  
[21:29:21]	[Step 1/1] | * 651f6f0ad6 2 days ago 
[21:29:21]	[Step 1/1] | * be70223f43 2 days ago 
[21:29:21]	[Step 1/1] | * a631a31f13 2 days ago 
[21:29:21]	[Step 1/1] | * ee0a425d1a 2 days ago 
[21:29:21]	[Step 1/1] | * 6c43de6a96 2 days ago 
[21:29:21]	[Step 1/1] | * 7dcab60967 2 days ago 
[21:29:21]	[Step 1/1] | * 71d8ae3feb 2 days ago 
[21:29:21]	[Step 1/1] | * 8b8041dc35 2 days ago 
[21:29:21]	[Step 1/1] | * 3e79f08a67 2 days ago 
[21:29:21]	[Step 1/1] | * d579a35c1e 2 days ago 
[21:29:21]	[Step 1/1] | * 3cb444932a 2 days ago 
[21:29:21]	[Step 1/1] | * d7451f7ed5 2 days ago 
[21:29:21]	[Step 1/1] | * 29f887b57b 2 days ago 
[21:29:21]	[Step 1/1] | * a5a2d76880 2 days ago 
[21:29:21]	[Step 1/1] | * 5b4d4e9807 2 days ago 
[21:29:21]	[Step 1/1] | * 75ae3fdeab 2 days ago 
[21:29:21]	[Step 1/1] | * ada6549d64 2 days ago 
[21:29:21]	[Step 1/1] | * a4c21967c2 2 days ago 
[21:29:21]	[Step 1/1] | * eb9856cf2c 2 days ago 
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] *   b7188226b2 3 days ago 
[21:29:21]	[Step 1/1] |\  
[21:29:21]	[Step 1/1] | * 70db63f741 3 days ago 
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] * 95e2209982 3 days ago 
[21:29:21]	[Step 1/1] *   1e9c5368a1 3 days ago 
[21:29:21]	[Step 1/1] |\  
[21:29:21]	[Step 1/1] | * 38202d0c3e 5 days ago 
[21:29:21]	[Step 1/1] | * 62898a0d73 5 days ago 
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] * 6b36cdc841 6 days ago 
[21:29:21]	[Step 1/1] *   61055d6704 6 days ago 
[21:29:21]	[Step 1/1] |\  
[21:29:21]	[Step 1/1] | * c858130961 6 days ago 
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] * 3222822fbe 6 days ago 
[21:29:21]	[Step 1/1] * d02e072d31 7 days ago 
[21:29:21]	[Step 1/1] * 52099c2dc8 7 days ago 
[21:29:21]	[Step 1/1] * 98e1e1c045 7 days ago 
[21:29:21]	[Step 1/1] * 245bb2b7b4 7 days ago 
[21:29:21]	[Step 1/1] * b9faa34aa5 7 days ago 
[21:29:21]	[Step 1/1] * 4ce69dec97 8 days ago 
[21:29:21]	[Step 1/1] * 8082475d27 8 days ago 
[21:29:21]	[Step 1/1] * 6f675c6414 8 days ago 
[21:29:21]	[Step 1/1] * fc64e9cddb 8 days ago 
[21:29:21]	[Step 1/1] | * 15db6eaf76 3 days ago  (origin/feature/CPD-971-integrateIEcgDiagGreenToPink)
[21:29:21]	[Step 1/1] | * 92d03b3e21 3 days ago 
[21:29:21]	[Step 1/1] | * b6f30d28e5 3 days ago 
[21:29:21]	[Step 1/1] | * 3aa5a208c5 3 days ago 
[21:29:21]	[Step 1/1] | * feacd73d96 3 days ago 
[21:29:21]	[Step 1/1] | * 8c5b70c4aa 3 days ago 
[21:29:21]	[Step 1/1] | * f59b3ecd9c 3 days ago 
[21:29:21]	[Step 1/1] | * 4a79b4443c 3 days ago 
[21:29:21]	[Step 1/1] | * 3b804f5d4e 3 days ago 
[21:29:21]	[Step 1/1] | * f49684621d 3 days ago 
[21:29:21]	[Step 1/1] | * 9f1647b7be 3 days ago 
[21:29:21]	[Step 1/1] | * debd521ab5 3 days ago 
[21:29:21]	[Step 1/1] | * 295fbaf941 3 days ago 
[21:29:21]	[Step 1/1] | * 05a1d58d03 3 days ago 
[21:29:21]	[Step 1/1] | * bc47b72136 9 days ago 
[21:29:21]	[Step 1/1] |/  
[21:29:21]	[Step 1/1] * 4daa6054e5 9 days ago 
[21:29:21]	[Step 1/1] * 1e39c64631 9 days ago 
[21:29:21]	[Step 1/1] * 363f9c9b68 9 days ago 
[21:29:21]	[Step 1/1] * e38a7da34f 9 days ago 
[21:29:21]	[Step 1/1] * 69dc4a8414 9 days ago 
[21:29:21]	[Step 1/1] * 8eb18d2480 9 days ago 
[21:29:21]	[Step 1/1] * 636f06acac 9 days ago 
[21:29:21]	[Step 1/1] * 963e82bf09 9 days ago 
[21:29:21]	[Step 1/1] *   956abce4ae 9 days ago 
[21:29:21]	[Step 1/1] |\  
[21:29:21]	[Step 1/1] | * c70101a46a 9 days ago 
[21:29:21]	[Step 1/1] | * 902663d538 9 days ago 
[21:29:21]	[Step 1/1] | * 1c111f7619 9 days ago 
[21:29:21]	[Step 1/1] | * 2e891b39d7 9 days ago 
[21:29:21]	[Step 1/1] | * a780ab0a5c 9 days ago 
[21:29:21]	[Step 1/1] | * 2d567e48aa 9 days ago 
[21:29:21]	[Step 1/1] | * 746d854e4b 9 days ago 
[21:29:21]	[Step 1/1] | * a251dcbc81 9 days ago 
[21:29:21]	[Step 1/1] | * 3e0ef21402 9 days ago 
[21:29:21]	[Step 1/1] | * c328de24bb 9 days ago 
[21:29:21]	[Step 1/1] Process exited with code 0

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

Here’s what I had to do in another repository for a Travis CI build:

before_install:
- git fetch --unshallow || true # Travis might do a shallow clone, but GitVersion needs the full history including branches and tags
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
- git fetch origin
- git branch master origin/master || true # GitVersion seems to require a local "master" branch these days. That's a bug, but oh well.
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then git checkout -b "$TRAVIS_PULL_REQUEST_BRANCH-pr"; fi # Create an explicit branch on pull requests as I'm unable to pass Git_Branch into the Docker container for some

Can you try out something similar in your build and see whether that helps?