azure-devopsazure-pipelinesgitversion

Azure DevOps Yaml Pipline gitversion/execute failing ObjectHandle.op_Implicit(ObjectHandle handle) in /_/LibGit2Sharp/Core/Handles/Objects.cs:line 509


Getting error when run task gitversion/execute on azure devops yaml pipeline An unexpected error occurred: System.NullReferenceException: Object reference not set to an instance of an object. at LibGit2Sharp.Core.Handles.ObjectHandle.op_Implicit(ObjectHandle handle) in /_/LibGit2Sharp/Core/Handles/Objects.cs:line 509 at LibGit2Sharp.Core.Proxy.git_commit_author(ObjectHandle obj) in /_/LibGit2Sharp/Core/Proxy.cs:line 289 at comming from ##[debug]fetchDepth=1 with not option to setup in yaml, as this was change as default value for Microsoft.


Solution

  • Option to setup fetch is hidden in ADO under pipeline Edit button -> Triggers -> enter image description here

    Or use

    variables:
      Agent.Source.Git.ShallowFetchDepth: 0
    

    or if the repository is also checkout as dedicated task

    steps:
      - checkout: self
        fetchDepth: 0
        clean: true