git still untracked after add

只愿长相守 提交于 2019-12-10 13:26:16

问题


Everytime I do git status there is this folder that appears as untracked.

$ git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       src/error/
nothing added to commit but untracked files present (use "git add" to track)

Even after doing git add ., git commit -a the folder at src/error keeps showing up as untracked. Other unstaged files get commited everytime only this folder keeps giving problems. Also git doesnt report any errors. What could be the problem here ?


回答1:


I found the problem and the solution this is what happened:

First src/error was called src/Error when i changed the case locally the foldername was changed but in git it was still commited as src/Error. Windows is case-insensitive so what i did was remove the folder commit and add it again with the right casing.




回答2:


Is that the folder empty if so it is normal, see here




回答3:


I've tried the following in a Windows 7 console and it worked, i.e. it did not show \src\error\ as untracked.

C:\t>dir
 Volume in drive C is BLAH
 Volume Serial Number is 2ECA-CB88

 Directory of C:\t

10.08.2010  17:56    <DIR>          .
10.08.2010  17:56    <DIR>          ..
               0 File(s)              0 bytes
               2 Dir(s)  59'844'902'912 bytes free

C:\t>mkdir .\src\error

C:\t>copy con: .\src\error\text.txt
blah^Z
        1 file(s) copied.

C:\t>git init
Initialized empty Git repository in C:/t/.git/

C:\t>git add .\src\error\*

C:\t>git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#       new file:   src/error/text.txt
#

This doesn't answer your question, but I thought it might help to see a full step-by-step example.



来源:https://stackoverflow.com/questions/3446929/git-still-untracked-after-add

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!