Skip to contentSkip to conversation

from symlinked directory: unable to chdir or not a git archive

DISCUSSION Marcel M. Cary 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

I'm getting an error:

fatal: 'origin': unable to chdir or not a git archive

when trying to pull even though pushing works just fine. So I don't think the problem is that the remote repository doesn't exist. (I see the entry in GitFaq for this error message, but I don't think that answer quite explains this situation.)

I think it's important that, when pulling, I'm in a directory that is a symlink into the Git working copy. Having git operate correctly in that environment is important to me because Git doesn't support checking out a subdirectory of my project.

A shell transcript follows that illustrates a simplified problem scenario using Git 1.6.0.1. I see the same error message with 1.6.0.2 and 1.6.0.2.530.g67faa (master branch today).

Is there an easy way around this? Right now I have to cd to the target of the symlink to do the pull, which is annoying.

Thanks,
Marcel

~/git$ mkdir tmp-repo
~/git$ cd tmp-repo/
~/git/tmp-repo$ git init
Initialized empty Git repository in /home/marcel/git/tmp-repo/.git/ ~/git/tmp-repo$ mkdir foo
~/git/tmp-repo$ touch foo/bar
~/git/tmp-repo$ git add foo/bar
~/git/tmp-repo$ git commit -m 'Add empty file'
Created initial commit 651b80a: Add empty file

 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 foo/bar

~/git/tmp-repo$ cd ..
~/git$ git clone tmp-repo clone-repo
Initialized empty Git repository in /home/marcel/git/clone-repo/.git/ ~/git$ ln -s clone-repo/foo/ foo-link
~/git$ cd foo-link/
~/git/foo-link$ echo hello >> bar
~/git/foo-link$ git commit -a -m 'Say hi'
Created commit 0a92c49: Say hi

 1 files changed, 1 insertions(+), 0 deletions(-)

~/git/foo-link$ git push origin master Counting objects: 7, done.
Writing objects: 100% (4/4), 281 bytes, done. Total 4 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (4/4), done.
To /home/marcel/git/tmp-repo/.git
651b80a..0a92c49 master -> master
~/git/foo-link$ git pull
fatal: 'origin': unable to chdir or not a git archive
fatal: The remote end hung up unexpectedly ~/git/foo-link$ cd ~/git/clone-repo/foo ~/git/clone-repo/foo$ git pull
Already up-to-date.
~/git/clone-repo/foo$

on Linux 2.6.18-4-486, ext3