GitVersion在TeamCity构建中引发身份验证错误

问题描述

我已经在TeamCity中为使用GitVersion管理版本控制的项目创建了一个版本。当我尝试让TeamCity运行构建时,它在构建日志中失败,并显示以下错误

An unexpected error occured:
LibGit2Sharp.LibGit2SharpException: authentication required but no callback set

我曾尝试在Google上搜索LibGit2Sharp错误,但只找到了几个已关闭错误报告,但没有详细说明它们如何解决错误

解决方法

设置构建的工件以捕获GitVersion生成的日志输出后,发现以下消息:

TeamCity doesn't make the current branch available through environmental variables.
Depending on your authentication and transport setup of your git VCS root things
may work. In that case,ignore this warning.

In your TeamCity build configuration,add a parameter called `env.Git_Branch` with
value %teamcity.build.vcs.branch.<vcsid>%

See http://gitversion.readthedocs.org/en/latest/build-server-support/build-server/teamcity
for more info

通过将env.Git_Branch参数设置为%teamcity.build.vcs.branch。%值,GitVersion开始工作。这本来应该是一个简单的解决方案,但是由于未捕获日志并且错误消息的搜索结果不成功,因此我决定发布此答案以帮助可能遇到此问题的其他人。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...