【问题标题】:Process 'command 'git'' finished with non zero exit value 128"进程 \'command \'git\'\' 以非零退出值 128\" 结束
【发布时间】:2022-10-25 15:41:10
【问题描述】:

我需要一些帮助我在 IntelliJ IDEA 中有一个 gradle 项目,我正在尝试使用 github 操作通过 github 自动化 gradle。我用于 github 操作的 .yml 文件包含

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

错误来自最后一步- name: Update Website working-directory: ./project run: ./gradlew deployReports

这是位于我的 build.gradle 文件中的 deployReports 函数

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']
    }
}

} 错误来自这一行commandLine = ['git', 'commit', '-m', 'Updating-webpages']

我不确定如何解决这个问题,因为 git 安装正确,我仍然可以提交并从终端推送自己。任何见解都会很棒!

【问题讨论】:

  • 您确定您的 CI 设置正确吗? 128通常与授权问题有关。
  • 这可能是因为您没有在工作流程中配置 git 用户。在提交之前尝试将git config user.name github-actionsgit config user.email github-actions@github.com 之类的内容添加到您的函数中,看看它是否能解决您的问题。

标签: github gradle github-actions


【解决方案1】:

最简单的解决方案是通过 GitHub 克隆分支(使用终端)。否则,请在此目录中设置 git,以便您能够解决此问题。

【讨论】:

    猜你喜欢
    • 2015-07-13
    • 2015-01-21
    • 2021-02-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-26
    • 1970-01-01
    相关资源
    最近更新 更多