无法通过 Git 跟踪长路径中的文件

发布于 2024-07-26 06:58:59 字数 1752 浏览 4 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

甜味超标? 2024-08-02 06:58:59

这些目录是空的吗? 如果是这样,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.

若有似无的小暗淡 2024-08-02 06:58:59

这些文件夹中的文件可能会被忽略吗? 检查您的 .gitignore 和 .git/info/exclude 文件。

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

最近可好 2024-08-02 06:58:59

如果 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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文