进程'命令'git'以非零退出值1结束 [英] Process 'command 'git' finished with non-zero exit value 1

查看:1448
本文介绍了进程'命令'git'以非零退出值1结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



以下是我的代码:



pre> 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)进程'命令'git''以非零退出值1结束


解决方案

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

  exec {
commandLinegit,submodule,update,--init,--recursive
}

完成此操作后,您无法使用git函数,但它对我成功编译起作用。


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

解决方案

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.

这篇关于进程'命令'git'以非零退出值1结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆