我有一个正常的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.
。
我做错了什么?
答案 0 :(得分:9)
这是早期版本的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.