【问题标题】:git pull with "--work-tree" flag fails带有“--work-tree”标志的 git pull 失败
【发布时间】:2013-02-11 10:01:21
【问题描述】:

我正在运行(在脚本中 - 试图避免使用 cd):

git --git-dir=/test/.git --work-tree=/test/ pull

得到:

fatal: /usr/lib/git-core/git-pull cannot be used without a working tree.

请注意,我已经运行了具有这种结构的其他命令(特别是 add、commit 和 pull),所以我认为这只是一个 pull 问题。

这里记录了一个类似的问题:Git pull fails to parse syntax,但它并不完全相同 - 它们得到一个不同的错误(它们在 Windows 上运行,所以谁知道......我在 Ubuntu 上)。

【问题讨论】:

标签: git git-pull


【解决方案1】:

感谢 isbadawi 的回答。

原来这个问题之前已经回答过:git pull while not in a git directory

简而言之,这是 git pull 的一个错误。但是,由于 pull 基本上是提取和合并的别名,因此以下内容相当于 pull(从上面的链接复制):

cd /X
git --git-dir=/X/Y/.git fetch
git --git-dir=/X/Y/.git --work-tree=/X/Y merge origin/master

【讨论】:

    猜你喜欢
    • 2012-04-26
    • 1970-01-01
    • 1970-01-01
    • 2011-11-13
    • 2014-04-14
    • 2012-06-03
    • 2021-12-25
    • 2015-06-26
    相关资源
    最近更新 更多