【问题标题】:error: pathspec 'CI]"' did not match any file(s) known to git错误:pathspec 'CI]"' 与 git 已知的任何文件都不匹配
【发布时间】:2019-03-02 07:42:16
【问题描述】:

我想用 groovy 在 Gradle Android 中运行 git 命令。 命令是commitskip ci 消息。

`git commit -m "[skip ci]"` 

我在 Gradle 任务中使用此代码

def git  = "git commit -m \"[skip ci]\"".execute()
git.waitFor()
println git.errorStream.text

在其他情况下,如git pullgit push,它执行没有任何问题,但在这种情况下,我遇到了这个错误。

提示:git 命令在终端中运行没有任何问题。

【问题讨论】:

  • @GenoChen 感谢您的建议,但事实并非如此。
  • 我现在没有 Groovy 环境,但似乎在传递到命令行之前空格被砍掉了。问题说明了防止早期砍伐的方法。
  • 也就是说,我猜"git commit -m \"[skip ci]\"".execute()实际上执行了git commit -m "\"[skip" "ci]\""
  • 很高兴为您解答。

标签: android git gradle groovy


【解决方案1】:

我找到了解决问题的方法。

    def git = ['sh', '-c', 'git commit -m "[skip ci]"'].execute()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-02-04
    • 2022-10-12
    • 1970-01-01
    • 2013-06-01
    • 1970-01-01
    • 2015-08-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多