git状态返回“致命的:不是git仓库”但.git目录存在 [英] git status returns "fatal: Not a git repository" yet .git directory exists

查看:115
本文介绍了git状态返回“致命的:不是git仓库”但.git目录存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个目前无法推送的远程文件夹。当我直接进入远程目录并执行'git status'时,它显示:

I have a remote folder that I am currently unable to push to. When I go directly to the remote directory and a do a 'git status' it reads:


致命:不是git存储库

fatal: Not a git repository

.git文件夹确实存在,并且昨天工作正常,此后没有任何更改。

The .git folder does exists and it was working fine yesterday and nothing has changed since.

任何人都可以告诉我为什么即使.git文件夹存在,我也可能会收到此消息吗?

Can anyone tell me the reason(s) why I might receive this message even though the .git folder exists?

预先感谢您的帮助。非常感谢!

Thanks in advance for your help. Much appreciated!

推荐答案

如果.git文件夹的权限没问题,请查看文件 .git / HEAD 存在或没有错误地命名为 .git / head 。存在 .git / HEAD (或者在裸机的情况下为HEAD)是对git存储库的二级检查

If the permissions on the .git folder are fine, see that there is a file .git/HEAD existing or is not named wrongly like .git/head. The presence of .git/HEAD ( or HEAD in case of bare) is the secondary check for a git repository

这篇关于git状态返回“致命的:不是git仓库”但.git目录存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆