-1

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)
$         
Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697
  • 3
    There is no problem with "long paths" in Git. Please show a complete example, starting from an empty repository with "git init", that demonstrates the problem you are seeing. Include both the output of commands and an explanation of what you expect to see. – Greg Hewgill Jul 04 '09 at 00:31
  • 1
    I tried what you showed on a new repository and everything worked as expected for me. That is, after running "git add shells/zsh/keyboard_configs/" the file I put in that directory was correctly shown in "git status" as a new file. Again, please show a complete example starting from "git init" to demonstrate your question. – Greg Hewgill Jul 04 '09 at 00:53
  • @Greg: Please, see Tim's answer. He solved the problem with empty .gitignore -files. – Léo Léopold Hertz 준영 Jul 04 '09 at 01:06
  • I see. I also tried with an empty directory, thinking that might have been what you were trying to do, but an empty directory did not show up as untracked for me in "git status". Which version of Git are you using? – Greg Hewgill Jul 04 '09 at 01:09
  • I upgraded to 1.6.3.2 thinking that the answer might be something different between my version and yours. I still can't quite reproduce what you saw, but I'm glad you found a solution that works for you. – Greg Hewgill Jul 04 '09 at 10:46
  • @Greg: The same problem occurs for me again. I opened a new question at http://stackoverflow.com/questions/1084969/unable-to-track-files-in-deep-directories-by-git – Léo Léopold Hertz 준영 Jul 05 '09 at 22:35

3 Answers3

5

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.

Tim Henigan
  • 60,452
  • 11
  • 85
  • 78
2

It could be that the files in those folders are somehow ignored? Check your .gitignore and .git/info/exclude files.

Tanj
  • 1,354
  • 1
  • 15
  • 25
0

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)

Kjartan
  • 18,591
  • 15
  • 71
  • 96