Skip to content

Commit 8b944d0

Browse files
author
Justin Thirkell
committed
added documentation for non-https github access (manually pulling down master branch via SSH)
1 parent e640857 commit 8b944d0

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Diff for: README.md

+26
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,32 @@ the project called `GitFlowVersion.NugetVersion`. If many of your projects uses
207207
can add the parameter to the "root-project" (TeamCity 8.x+)
208208
* Then setup you nuget pack build set the "version" to `%GitFlowVersion.NugetVersion%`
209209

210+
### When TeamCity -> GitHub can't use https
211+
GitFlowVersion requires the presence of master branch in order to determine the version number. If TeamCity uses https to clone git repos then GitFlowVersion will pull down master branch for you during the build.
212+
213+
If however your TeamCity uses SSH to clone git repos and https is unavailable then GitFlowVersion will error with a message like
214+
> [GitFlowVersionTask.UpdateAssemblyInfo] Error occurred: GitFlowVersion.MissingBranchException: Could not fetch from '[email protected]:Xero/Bus.git' since LibGit2 does not support the transport. You have most likely cloned using SSH. If there is a remote branch named 'master' then fetch it manually, otherwise please create a local branch named 'master'. ---> LibGit2Sharp.LibGit2SharpException: An error was raised by libgit2. Category = Net (Error).
215+
This transport isn't implemented. Sorry
216+
217+
You need to create a TeamCity build step before your compile step which manually creates a local master branch which tracks remote master. Like so (in powershell):
218+
219+
```Powershell
220+
$branchBeingBuilt = . git symbolic-ref --short -q HEAD
221+
. git pull 2>&1 | write-host
222+
foreach ($remoteBranch in . git branch -r) {
223+
. git checkout $remoteBranch.Trim().Replace("origin/", "") 2>&1 | write-host
224+
. git pull 2>&1 | write-host
225+
}
226+
. git checkout $branchBeingBuilt 2>&1 | write-host
227+
```
228+
229+
you should get build output like
230+
[Step 1/1]: Ensure all branches are available for GitFlowVersion (Powershell) (5s)
231+
[Step 1/1] From file:///C:/BuildAgent2/system/git/git-12345678
232+
[Step 1/1] * [new branch] master -> origin/master
233+
[Step 1/1] Switched to a new branch 'master'
234+
[Step 1/1] Branch master set up to track remote branch master from origin.
235+
[Step 1/1] Switched to branch 'develop'
210236

211237
## For reference
212238

0 commit comments

Comments
 (0)