How to use -work-tree parameter with git? I keep getting an error

I have a normal repo where there is a working tree and a .git folder in the same directory as the working tree.

I am trying to run the git command from outside this location using the command

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

but I keep getting fatal: /usr/libexec/git-core/git-pull cannot be used without a working tree. error fatal: /usr/libexec/git-core/git-pull cannot be used without a working tree. .

What am I doing wrong?

+8
git git-commit git-pull git-push
source share
1 answer

This is a bug in earlier versions of Git. This problem should disappear after updating to version 1.7.7.2 or later.

From commit, bug fixed :

 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. 

See also commit e2eb527 .

+9
source share

All Articles