Skip to content

LibGit2Sharp.LibGit2SharpException: UsernamePasswordCredentials contains a null Username or Password. #2807

@be-prokom

Description

@be-prokom

Describe the bug
When running

gitversion /l console /output buildserver /updateAssemblyInfo

GitVersion.Portable v5.6.11 gives the exception

ERROR [08/05/21 13:18:30:28] An unexpected error occurred:
LibGit2Sharp.LibGit2SharpException: UsernamePasswordCredentials contains a null Username or Password.
at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result)
at LibGit2Sharp.Core.Proxy.git_remote_fetch(RemoteHandle remote, IEnumerable 1 refSpecs, GitFetchOptions fetchOptions, String logMessage)
at LibGit2Sharp.Commands.Fetch(Repository repository, String remote, IEnumerable`1 refspecs, FetchOptions options, String logMessage)
at GitVersion.Helpers.GitRepositoryHelper.Fetch(ILog log, AuthenticationInfo authentication, Remote remote, Repository repo)
at GitVersion.Helpers.GitRepositoryHelper.NormalizeGitDirectory(ILog log, IEnvironment environment, String gitDirectory, AuthenticationInfo authentication, Boolean noFetch, String currentBranch, Boolean isDynamicRepository)
at GitVersion.GitPreparer.NormalizeGitDirectory(AuthenticationInfo auth, String targetBranch, String gitDirectory, Boolean isDynamicRepository)
at GitVersion.GitPreparer.Prepare(Boolean normalizeGitDirectory, String currentBranch, Boolean shouldCleanUpRemotes)
at GitVersion.GitVersionCalculator.CalculateVersionVariables()
at GitVersion.ExecCommand.Execute()
at GitVersion.GitVersionExecutor.VerifyArgumentsAndRun(Arguments arguments)

This is the same error as in #2247

This result in %GitVersion_NuGetVersionV2% not having any value.

Expected Behavior

Get hold of %GitVersion_NuGetVersionV2%

Actual Behavior

%GitVersion_NuGetVersionV2% has no value

Possible Fix

Steps to Reproduce

GITVERSION_REMOTE_USERNAME=access_token
GITVERSION_REMOTE_PASSWORD=empty

Install giversion.portable. Version 5.6.11 was installled
choco install gitversion.portable

Run
gitversion /l console /output buildserver /updateAssemblyInfo

I tried to install 5.3.0 but it gave the same error.

Context

It breaks my builds on Appveyor.

Your Environment

Running in Appveyor

  • Version Used:
    os: Visual Studio 2015

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions