如何在git中使用--work-tree选项?我不断收到错误消息 [英] How do I use the --work-tree option with git? I keep getting an error
本文介绍了如何在git中使用--work-tree选项?我不断收到错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个普通的仓库,其中有一个工作树和一个与工作树相同的目录中的.git文件夹.
I have a normal repo where there is a working tree and a .git folder in the same directory as the working tree.
我正在尝试使用此命令从此位置之外运行git命令
I'm trying to run a git command from outside this location with the command
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或更高版本后,该问题应消失.
This is a bug in earlier versions of Git. This problem should go away once you upgrade to 1.7.7.2 or later.
来自修复了该错误的提交:
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 .
这篇关于如何在git中使用--work-tree选项?我不断收到错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文