无法通过Git跟踪长PATH中的文件 [英] Unable to track files in long PATHs by Git

查看:230
本文介绍了无法通过Git跟踪长PATH中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

>

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



我运行失败

  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 
#分支大师
#未追踪文件:
#(使用git add< ; file> ...包含在将要提交的内容中)

#shells / zsh / keyboard_configs /
#shells / zsh / references /
没有添加任何提交但未跟踪的文件存在(使用git add来跟踪)
$ git add shell / zsh / keyboard_configs〜/ bin
$ git add shells / zsh / references 〜/ bin

以下是意想不到的情况。我希望我添加了要跟踪的文件夹及其内容。

  $ git status〜/ bin 
#关于分支大师
#未追踪的文件:
#(使用git add< file> ...来包含将要提交的内容)

#shells / zsh / keyboard_configs /
#shells / zsh / references /
没有添加提交但未跟踪文件存在(使用git add跟踪)
$


解决方案

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



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

有关此设计决策的一些背景信息,请参阅此主题来自Git电子邮件列表。


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

解决方案

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.

这篇关于无法通过Git跟踪长PATH中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆