-
Notifications
You must be signed in to change notification settings - Fork 650
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added documentation for non-https github access (manually pulling dow…
…n master branch via SSH)
- Loading branch information
Justin Thirkell
committed
Dec 6, 2013
1 parent
e640857
commit 8b944d0
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,6 +207,32 @@ the project called `GitFlowVersion.NugetVersion`. If many of your projects uses | |
can add the parameter to the "root-project" (TeamCity 8.x+) | ||
* Then setup you nuget pack build set the "version" to `%GitFlowVersion.NugetVersion%` | ||
|
||
### When TeamCity -> GitHub can't use https | ||
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. | ||
|
||
If however your TeamCity uses SSH to clone git repos and https is unavailable then GitFlowVersion will error with a message like | ||
> [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). | ||
This transport isn't implemented. Sorry | ||
|
||
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): | ||
|
||
```Powershell | ||
$branchBeingBuilt = . git symbolic-ref --short -q HEAD | ||
. git pull 2>&1 | write-host | ||
foreach ($remoteBranch in . git branch -r) { | ||
. git checkout $remoteBranch.Trim().Replace("origin/", "") 2>&1 | write-host | ||
. git pull 2>&1 | write-host | ||
} | ||
. git checkout $branchBeingBuilt 2>&1 | write-host | ||
``` | ||
|
||
you should get build output like | ||
[Step 1/1]: Ensure all branches are available for GitFlowVersion (Powershell) (5s) | ||
[Step 1/1] From file:///C:/BuildAgent2/system/git/git-12345678 | ||
[Step 1/1] * [new branch] master -> origin/master | ||
[Step 1/1] Switched to a new branch 'master' | ||
[Step 1/1] Branch master set up to track remote branch master from origin. | ||
[Step 1/1] Switched to branch 'develop' | ||
|
||
## For reference | ||
|
||
|
8b944d0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, what's the difference to "git fetch --all"?
8b944d0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From memory I did try that but had issues (sorry, can't remember what) - so I just stuck with checking out each remote branch.
btw, since then I've had more success using git readonly protocol and I no longer need to manually fetch master branch. See #99 (comment)