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

时间:2020-09-16 18:35:10

标签: teamcity gitversion

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

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

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

1 个答案:

答案 0 :(得分:0)

设置构建的工件以捕获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开始工作。这本来应该是一个简单的解决方案,但是由于未捕获日志并且错误消息的搜索结果不成功,因此我决定发布此答案以帮助可能遇到此问题的其他人。