git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
MCMarcel M. Cary <marcel@earth.care2.com>
Date
Oct 14, 2008, 22:58 UTC
Message-ID
<48F52405.6010406@earth.care2.com>
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
Message 1 of 1 in “from symlinked directory: unable to chdir or not a git archive”
  1. Marcel M. CaryOct 14, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.