如何在git中使用--work tree选项?我总是出错

如何在git中使用--work tree选项?我总是出错,git,git-push,git-pull,git-commit,Git,Git Push,Git Pull,Git Commit,我有一个普通的repo,其中有一个工作树和一个.git文件夹,位于与工作树相同的目录中 我正在尝试使用该命令从该位置之外运行git命令 git --git-dir=/path/to/repo/.git --work-tree=/path/to/repo pull /some/other/repo master 但是我不断收到错误致命:/usr/libexec/git core/git pull如果没有工作树就无法使用。 我做错了什么?这是Git早期版本中的一个bug。升级到1.7.7.2或更高

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

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

git --git-dir=/path/to/repo/.git --work-tree=/path/to/repo pull /some/other/repo master
但是我不断收到错误
致命:/usr/libexec/git core/git pull如果没有工作树就无法使用。


我做错了什么?

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

发件人:


另请参见。

您当前的工作目录是什么?您使用的是什么版本的Git?它是这样的:所有文件(工作树)都在某个文件夹中,如
/some/repo
,而该文件夹中还有一个.Git文件夹
/some/repo/.Git
。我通常会从
/some/repo
内部运行git命令。我有版本
1.7.2.3
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.