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

时间:2014-04-06 00:18:48

标签: git

我是git的新手。我只是用它来控制本地机器的版本。我已经git init初始化了我的git repo。我已经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”的文件夹。删除它并正常工作

1 个答案:

答案 0 :(得分:2)

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

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

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

相关问题