'Process 'command 'git'' finished with non zero exit value 128"

I need some help I have a gradle project within the IntelliJ IDEA and I'm trying to automate gradle with github using the github actions. My .yml file for the github action contains

name: CI - build and test

on:
  push:
    branches: [ main ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK 11
        uses: actions/setup-java@v2
        with:
          java-version: '11'
          distribution: 'adopt'
      - name: Grant execute permission for gradlew
        working-directory:  ./project
        run: chmod +x ./gradlew
      - name: Build
        working-directory:  ./project
        run: ./gradlew build
      - name: Test
        working-directory:  ./project
        run: ./gradlew test
      - name: Update Website
        working-directory: ./project
        run: ./gradlew deployReports

The error is coming from the final step - name: Update Website working-directory: ./project run: ./gradlew deployReports

here is the function for deployReports located within my build.gradle file

task deployReports (dependsOn: 'copyWebsite'){
group = "Reporting"
description 'Copies reports to the website repo and pushes to github'
doLast{
    def pagesDir = "$buildDir/gh-pages"
    exec{
        workingDir = 'build/gh-pages'
        commandLine = ['git', 'add', '.']
    }
    exec{
        workingDir = 'build/gh-pages'
        commandLine = ['git', 'commit', '-m', 'Updating-webpages']
    }
    exec{
        workingDir = 'build/gh-pages'
        commandLine = ['git', 'push']
    }
}

} The error is coming from this line commandLine = ['git', 'commit', '-m', 'Updating-webpages']

I'm unsure of how to fix this because git is installed correctly and I can still commit and push myself from the terminal. any insight would be great!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source