无法通过 Git 跟踪长路径中的文件
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
当我在How can you git-add files at long PATHs?
我运行
$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)
$
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)
$
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这些目录是空的吗? 如果是这样,Git 不会跟踪空目录。
如果您确实需要将这些目录添加到存储库中,请尝试在每个目录中添加一个空的“.gitignore”文件。
有关此设计决策的一些背景信息,请参阅来自Git 电子邮件列表。
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.
这些文件夹中的文件可能会被忽略吗? 检查您的 .gitignore 和 .git/info/exclude 文件。
It could be that the files in those folders are somehow ignored? Check your .gitignore and .git/info/exclude files.
如果 git config --system core.longpaths true 没有解决问题,您应该尝试更改 git 存储库的位置,如“C:/”下。
(例如:C:/gitRepo)
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)