我有一个 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).
我有一个 .git 目录,其中填充了我对该存储库的数千次提交。我不想重新初始化存储库,因为担心它会覆盖历史记录。我也不想从 github 重新拉取它,因为我已经在分支中保存了一些更改,但我已经有一段时间没有将其推送到 GH 了。
edit:
我相当确定这不是我的环境。其他 git 存储库工作得很好
我想从适当的 git 源文件中发表一些评论:
Git 存储库发现按如下方式完成:
/*
* Test in the following order (relative to the cwd):
* - .git (file containing "gitdir: <path>")
* - .git/
* - ./ (bare)
* - ../.git
* - ../.git/
* - ../ (bare)
* - ../../.git/
* etc.
*/
它确定它是一个 git 存储库,如下所示:
/*
* 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.
*/
看看你的有什么问题.git
。这与 @Chris Nicola 的回答有关HEAD
小写等
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)