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

use*_*740 7 git

我是git的新手.我只是用它来控制本地机器的版本.我已经初始化了我的git repo git init.我手动添加了一些我需要的文件夹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
Run Code Online (Sandbox Code Playgroud)

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

Cod*_*ard 2

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

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

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