-1

Git说要使用

git add

将未跟踪的文件添加到我的仓库。

我跑不成功

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 .

当我在

git status

如何在长路径上添加文件?


我跑

$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 

以下是出乎意料的。我希望我也添加了要跟踪的文件夹及其内容。

$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)
$         
4

3 回答 3

5

这些目录是空的吗?如果是这样,Git 不会跟踪空目录。

如果您确实需要将这些目录添加到您的存储库,请尝试在每个目录中添加一个空的“.gitignore”文件。

有关此设计决策的一些背景信息,请参阅Git 电子邮件列表中的此线程

于 2009-07-04T00:57:58.427 回答
2

可能是这些文件夹中的文件以某种方式被忽略了?检查您的 .gitignore 和 .git/info/exclude 文件。

于 2009-07-04T00:51:05.400 回答
0

如果git config --system core.longpaths true没有解决问题,您应该尝试将 git repos 的位置更改为“C:/”下的位置。(例如:C:/gitRepo)

于 2019-09-12T10:29:32.753 回答