Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git repo erroring with message that it's not a repo... but it is

Tags:

git

I have a git repo I've been using for the last year on the same box. Today I run git status and get the error message:

fatal: Not a git repository (or any parent up to mount parent /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

I have a .git directory and it's populated with the thousands of commits I have for that repo. I don't want to re-initialize the repo in fear that it'll overwrite the history. I also don't really want to re-pull it from github as I've got a few changes stashed in branches that I haven't pushed up to GH in a while.

edit:

I'm reasonably sure it's not my environment. Other git repos are working just fine

like image 788
brycemcd Avatar asked Jun 07 '11 17:06

brycemcd


1 Answers

I would like to post some comments from the appropriate source file of git:

Git repo discovery is done as per below:

/*
 * Test in the following order (relative to the cwd):
 * - .git (file containing "gitdir: <path>")
 * - .git/
 * - ./ (bare)
 * - ../.git
 * - ../.git/
 * - ../ (bare)
 * - ../../.git/
 *   etc.
 */

And it ascertains that it is a git repo as below:

/*
 * Test if it looks like we're at a git directory.
 * We want to see:
 *
 *  - either an objects/ directory _or_ the proper
 *    GIT_OBJECT_DIRECTORY environment variable
 *  - a refs/ directory
 *  - either a HEAD symlink or a HEAD file that is formatted as
 *    a proper "ref:", or a regular file HEAD that has a properly
 *    formatted sha1 object name.
 */

See what's wrong with your .git. This ties in with @Chris Nicola 's answer of the HEAD being lowercase etc.

like image 167
manojlds Avatar answered Sep 17 '22 12:09

manojlds