9

我有一个普通的仓库,其中有一个工作树和一个 .git 文件夹,与工作树位于同一目录中。

我正在尝试使用该命令从该位置外部运行 git 命令

git --git-dir=/path/to/repo/.git --work-tree=/path/to/repo pull /some/other/repo master

但我不断收到错误fatal: /usr/libexec/git-core/git-pull cannot be used without a working tree.

我究竟做错了什么?

4

1 回答 1

10

这是早期版本的 Git 中的错误。升级到 1.7.7.2 或更高版本后,此问题应该会消失。

修复错误的提交中

You can't currently run git-pull or git-rebase from outside
of the work tree, even with GIT_WORK_TREE set, due to an
overeager require_work_tree function. Commit e2eb527
documents this problem and provides the infrastructure for a
fix, but left it to later commits to audit and update
individual scripts.

另请参阅提交 e2eb527

于 2012-03-17T05:38:55.073 回答