Jenkins Integration Issues

Hey everyone!

I’ve been trying to follow the Jenkins, CI and Test-Driven Development article in order to create a Continuous Integration environment using Jenkins. I’ve slightly updated it to use Unreal 5.1, but I am stuck in a problem right when the pipeline tries to fetch my project from GitHub… Here’s the output log of the pipeline

Started by user admin
14:48:02 Connecting to https://api.github.com using XXXXXXXXXX@gmail.com/******
Obtained Jenkinsfile from 99e52a7825a196e676360d3fb2b7c79e8886f3c6
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in C:\ProgramData\Jenkins\.jenkins\workspace\UE4-TDD-CI_Testing_main
[Pipeline] {
[Pipeline] ws
Running in C:\Unreal\Workspace
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
The recommended git tool is: NONE
using credential b085e6b7-775b-417d-a965-26a369181923
 > git.exe rev-parse --resolve-git-dir C:\Unreal\Workspace\.git # timeout=10
Fetching changes from the remote Git repository
 > git.exe config remote.origin.url https://github.com/XXXXXXXXXX/UE4-TDD-CI_Testing.git # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://github.com/XXXXXXXXXX/UE4-TDD-CI_Testing.git

//...

Caused by: hudson.plugins.git.GitException: Command "git.exe config remote.origin.url https://github.com/XXXXXXXXXX/UE4-TDD-CI_Testing.git" returned status code 128:
stdout: 
stderr: fatal: not in a git directory

//...

[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // ws
[Pipeline] }
[Pipeline] // node
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] echo
Tests finished, printing log.

//...

[Pipeline] echo
!!! FAILURE !!!
[Pipeline] }
[Pipeline] // stage
[Pipeline] End of Pipeline
ERROR: Error fetching remote repo 'origin'

Could not update commit status, please check if your scan credentials belong to a member of the organization or a collaborator of the repository and repo:status scope is selected


GitHub has been notified of this commit’s build result

Finished: FAILURE

It looks like the main issue here is this fatal: not in a git directory

My Jenkinsfile looks like this

pipeline {
  agent {
    node {
      label 'master'
      customWorkspace "C:\\Unreal\\Workspace"//use backward slashes to avoid problems with how Windows uses directories!!
    }
  }//^all this is necessary to run the build in a special workspace.
  environment {
    ue5Path = "C:\\Program Files\\Epic Games\\UE_5.1"
    ue5Project = "CITesting"
    ueProjectFileName = "${ue5Project}.uproject"
    testSuiteToRun = "Game."//the '.' is used to run all tests inside the prettyname. The automation system searches for everything that has 'Game.' in it, so otherGame.'s tests would run too...
    testReportFolder = "TestsReport"
    testsLogName = "RunTests.log"
    pathToTestsLog = "${env.WORKSPACE}" + "\\Saved\\Logs\\" + "${testsLogName}"
    codeCoverageReportName="CodeCoverageReport.xml"
  }
  stages {
    stage('Building') {
      steps {
        echo 'Build Stage Started.'

        bat "BuildWithoutCooking.bat \"${ue5Path}\" \"${env.WORKSPACE}\" \"${ueProjectFilename}\""//builds our project
      }
      post {
        success {
          echo 'Build Stage Successful.'
        }
        failure {
          echo 'Build Stage Unsuccessful.'
        }
      }
    }

    stage('Testing') {
      steps {
        echo 'Testing Stage Started.'

        bat "TestRunnerAndCodeCoverage.bat \"${ue5Path}\" \"${env.WORKSPACE}\" \"${ueProjectFilename}\" \"${testSuiteToRun}\" \"${testReportFolder}\" \"${testsLogName}\" \"${codeCoverageReportName}\""//runs the tests
      }
      post {
        success {
          echo 'Testing Stage Successful.'
        }
        failure {
          echo 'Testing Stage Unsuccessful.'
        }
      }
    }


  }
  post {
    always{
      echo 'Tests finished, printing log.'

      echo 'Cleaning up workspace:'
      echo '-checking current workspace.'
      powershell label: 'show workspace', script: 'dir $WORKSPACE'
      bat 'git reset --hard'//resets to HEAD, to the commit in the cloned repository.
      bat 'git clean -dffx .'//removes untracked files.
      echo '-checking clean workspace.'
      powershell label: 'show workspace', script: 'dir $WORKSPACE'

      echo 'Result:'
    }
    success{
        echo '!!! SUCCESS !!!'
    }
    unstable{
        echo '!!! UNSTABLE !!!'
    }
    failure{
        echo '!!! FAILURE !!!'
    }
  }
}

Any ideas what could be causing the error?

Thanks!