我有一个普通的 repo,其中有一个工作树和一个与工作树位于同一目录中的 .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.
。
我做错了什么?
最佳答案
这是 Git 早期版本中的一个错误。升级到 1.7.7.2 或更高版本后,此问题应该会消失。
来自 the commit that fixed the bug :
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.
另见 commit e2eb527 .
关于git - 我如何使用 git 的 --work-tree 选项?我不断收到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9745941/