【问题标题】:Process 'command 'git' finished with non-zero exit value 1进程 'command 'git' 以非零退出值 1 结束
【发布时间】:2015-07-13 15:18:51
【问题描述】:

我想在清单文件中自动实现更新修订号。

这是我的代码:

def getGitRevision(){
    new ByteArrayOutputStream().withStream { os ->
        exec {
            commandLine 'git', 'rev-list', 'HEAD', '--count'
            args = ['info']
            standardOutput = os
        }
        def outputAsString = os.toString()
        def matchLastChangedRev = outputAsString =~ /Last Changed Rev: (\d+)/

        ext.gitRev = "${matchLastChangedRev[0][1]}".toInteger()
    }

    return String.valueOf(gitRev);
}

但它会引发以下错误:

错误:(10, 0) Process 'command 'git'' 以非零退出值 1 结束

【问题讨论】:

  • 你可以用 --info 执行它以获取有关失败的扩展信息吗?
  • 这个命令在 std err 流上打印什么?

标签: android git gradle revision-history


【解决方案1】:

打开'settings.gradle'文件,然后你可以删除一些代码如下:

exec {
    commandLine "git", "submodule", "update", "--init", "--recursive"
}

完成后,你不能使用git功能,但它对我编译成功。

【讨论】:

    猜你喜欢
    • 2022-10-25
    • 1970-01-01
    • 1970-01-01
    • 2021-02-27
    • 1970-01-01
    • 2020-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多