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

Error "fatal: not a git repository" after auto packing

From
LCLuke Campagnola <luke.campagnola@gmail.com>
Date
Aug 11, 2014, 22:56 UTC
Message-ID
<CACZXET_qPzBtqJLXBbou+iZ_Muj=VqCBe5qMADN72VScsuHRVQ@mail.gmail.com>
Greetings,

I have been working happily with git for a couple of years, and ran into a mysterious issue today: after running a git-pull during which I saw the message "Auto packing the repository for optimum performance". I now receive the error "Fatal: not a git repository" when running any git commands, and a little investigation revealed that my .git/refs directory has gone missing, presumably because the refs were all combined into .git/packed-refs. To restore access to the repository, all I needed was to `mkdir .git/refs`. Is this a known bug? It seems like either git should tolerate the absence of a .git/refs directory, or the auto packer should not remove it.

I am using git 1.9.1 on kubuntu 14.04. The surrounding console output follows:
raven:/home/luke/vispy (transform-cache)$ git commit -a
[transform-cache 15a0fe3] Optimizations for grid_large
 6 files changed, 91 insertions(+), 52 deletions(-)
raven:/home/luke/vispy (transform-cache)$ git push lcampagn transform-cache
Counting objects: 114, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (31/31), done.
Writing objects: 100% (31/31), 4.00 KiB | 0 bytes/s, done.
Total 31 (delta 25), reused 0 (delta 0)
To git@github.com:lcampagn/vispy.git
   24b37a6..15a0fe3  transform-cache -> transform-cache
raven:/home/luke/vispy (transform-cache)$ git fetch vispy
remote: Counting objects: 78, done.
remote: Compressing objects: 100% (78/78), done.
remote: Total 78 (delta 34), reused 0 (delta 0)
Unpacking objects: 100% (78/78), done.
From https://github.com/vispy/vispy
   ec740af..fd8aa37  master     -> vispy/master
Auto packing the repository for optimum performance. You may also
run "git gc" manually. See "git help gc" for more information.
Counting objects: 5349, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5315/5315), done.
Writing objects: 100% (5349/5349), done.
Total 5349 (delta 3977), reused 0 (delta 0)
Removing duplicate objects: 100% (256/256), done.

raven:/home/luke/vispy (transform-cache)$ git checkout master Switched to branch 'master' Deleted 103 .pyc files Deleted 11 empty directories

raven:/home/luke/vispy$ git pull vispy master fatal: Not a git repository (or any of the parent directories): .git

raven:/home/luke/vispy$ git status fatal: Not a git repository (or any of the parent directories): .git

raven:/home/luke/vispy$ ls -al .git total 288 drwxr-xr-x 6 luke luke 4096 Aug 11 17:09 . drwxr-xr-x 9 luke luke 4096 Aug 11 09:25 .. -rw-r--r-- 1 luke luke 601 Aug 11 12:22 COMMIT_EDITMSG -rw-rw-r-- 1 luke luke 1088 Aug 11 09:21 config -rw-r--r-- 1 luke luke 73 Mar 2 08:41 description -rw-r--r-- 1 luke luke 323 Aug 11 16:56 FETCH_HEAD -rw-r--r-- 1 luke luke 337 Mar 3 10:18 GIT_COLA_MSG -rw-r--r-- 1 luke luke 193478 Aug 11 11:14 gitk.cache -rw-rw-r-- 1 luke luke 23 Aug 11 17:09 HEAD drwxr-xr-x 2 luke luke 4096 Mar 8 07:30 hooks -rw-rw-r-- 1 luke luke 31104 Aug 11 17:09 index drwxr-xr-x 2 luke luke 4096 Aug 11 16:57 info drwxr-xr-x 3 luke luke 4096 Aug 11 16:56 logs drwxr-xr-x 105 luke luke 4096 Aug 11 16:57 objects -rw-rw-r-- 1 luke luke 41 Aug 11 09:25 ORIG_HEAD -rw-rw-r-- 1 luke luke 8210 Aug 11 16:56 packed-refs

Next: Duy Nguyen
Message 1 of 4 in “Error "fatal: not a git repository" after auto packing”
  1. Luke CampagnolaAug 11, 2014
  2. Duy NguyenAug 12, 2014
  3. Dennis KaarsemakerAug 12, 2014
  4. Luke CampagnolaAug 12, 2014

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.