问题描述
我有一个git repo,我去年在同一个盒子里用过。今天我运行 git status
并得到错误信息:
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).
我有一个.git目录,并且填充了我对该回购的数千次提交。我不想重新初始化回购,因为它担心它会覆盖历史。我也不想真的想从github中重新获得它,因为我在一段时间内在分支中存储了一些变化,在一段时间内我还没有推到GH。
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.
编辑:
我相当确定这不是我的环境。其他git repos工作正常
I'm reasonably sure it's not my environment. Other git repos are working just fine
推荐答案
我想从git的相应源文件发布一些评论:
I would like to post some comments from the appropriate source file of git:
Git repo discovery按以下方式完成:
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.
*/
它确定它是一个git回购,如下所示:
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.
*/
查看 .git
。这与@Chris Nicola的答案
HEAD
是小写字母等。
这篇关于Git回购错误消息,它不是回购...但它是的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!