Process 'command 'git' finished with non-zero exit value 1

隐身守侯 提交于 2019-12-24 13:13:54

问题


I want to implement an update revision number automatically in the manifest file.

Here is my code:

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);
}

But it throws the following error:

Error:(10, 0) Process 'command 'git'' finished with non-zero exit value 1


回答1:


Open the 'settings.gradle' file, and then you may delete some code as follow:

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

After finished this, you can't use the git function, but it worked for me to compile successfully.



来源:https://stackoverflow.com/questions/30026730/process-command-git-finished-with-non-zero-exit-value-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!