问题
Git says to use
git add
to add untracked files to my repo.
I have run unsuccessfully
git add shells/zsh/keyboard_configs/
git add shells/zsh/references/
git add shells/zsh/keyboard_configs/*
git add shells/zsh/references/*
git add shells/zsh/keyboard_configs/*<TAB>
git add shells/zsh/references/*<TAB>
git add .
I still get that the files are untracked when I see it at
git status
How can you git-add files at long PATHs?
I run
$git status ~/bin
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# shells/zsh/keyboard_configs/
# shells/zsh/references/
nothing added to commit but untracked files present (use "git add" to track)
$git add shells/zsh/keyboard_configs ~/bin
$git add shells/zsh/references ~/bin
The following is what is unexpected. I would expect that I added the folders to be tracked and their contents too.
$git status ~/bin
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# shells/zsh/keyboard_configs/
# shells/zsh/references/
nothing added to commit but untracked files present (use "git add" to track)
$
回答1:
Are these directories empty? If so, Git does not track empty directories.
If you really need to add those directories to your repository, try adding an empty ".gitignore" file in each one.
For some background information on this design decision, see this thread from the Git email list.
回答2:
It could be that the files in those folders are somehow ignored? Check your .gitignore and .git/info/exclude files.
回答3:
If git config --system core.longpaths true
did not resolve the issue, you should try change the git repos' location as under the "C:/".
(EX: C:/gitRepo)
来源:https://stackoverflow.com/questions/1081173/unable-to-track-files-in-long-paths-by-git