繁体   English   中英

致命:不是git存储库 - 错误

[英]fatal: Not a git repository - Error

我是git的新手。 我只是用它来控制本地机器的版本。 我已经通过git init初始化了我的git repo。 我通过git add "folder name"手动添加了一些我需要的git add "folder name" 有一个特定的文件夹,我无法通过使用相同的命令添加。 它与其他目录包含在同一目录中。 但我一直fatal: Not a git repository "some path" 我不明白问题是什么。

添加输出

root@CTO:/home/kougaikw/test# git --version
git version 1.8.3.2

root@CTO:/home/kougaikw/test# git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#       new file:   main.html
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       .DS_Store
#       css/
#       fonts/
#       images/
#       instance-config.json


root@CTO:/home/kougaikw/test# ls -l
total 36
drwxr-xr-x  2 root root 4096 Apr  5 17:04 css
drwxr-xr-x  2 root root 4096 Apr  5 17:04 fonts
drwxr-xr-x  5 root root 4096 Apr  5 17:04 images
-rw-r--r--  1 root root 1004 Mar 13 08:25 instance-config.json
drwxr-xr-x 10 root root 4096 Apr  5 17:05 js
-rw-r--r--  1 root root  695 Jan  7 08:50 main.html
drwxr-xr-x  8 root root 4096 Apr  5 17:06 mocks
drwxr-xr-x 13 root root 4096 Apr  5 17:07 plugins
drwxr-xr-x 14 root root 4096 Apr  5 17:07 templates

root@CTO:/home/kougaikw/test# git add js
fatal: Not a git repository: js/libs/testfolder/../../../../.git/testfolder/html/js/libs/modules

我在js / libs / testfolder目录下有一个名为“.git”的文件夹。 删除它,并正常工作

git中有一个错误允许你在你的git项目下添加任何[.git | GIT]文件夹,这个文件已在后来的git版本中修复。

在您的情况下,您在一个项目文件夹中添加了一个名为[.git]的文件夹,因此git在处理您的存储库时遇到了问题。

有关错误和修复的更多信息可以在这里找到

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM