Git repo错误消息,它不是一个回购......但确实如此

bry*_*mcd 8 git

我有一个我去年在同一个盒子上使用的git repo.今天我运行git status并收到错误消息:

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

我有一个.git目录,它填充了我为该repo提供的数千次提交.我不想重新初始化回购,因为担心它会覆盖历史.我也不是真的想从github重新拉出它,因为我已经在分支机构中隐藏了一些变化,我有一段时间没有推到GH.

编辑:

我有理由相信这不是我的环境.其他git回购工作正常

man*_*lds 7

我想从git的相应源文件中发布一些注释:

Git repo发现如下:

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

它确定它是一个git repo如下:

/*
 * 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.
 */
Run Code Online (Sandbox Code Playgroud)

看你的错了.git.这与@Chris Nicola关于HEAD小写等的回答有关.