Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么我的.gitignore文件不忽略特定文件?_Git_Gitignore - Fatal编程技术网

为什么我的.gitignore文件不忽略特定文件?

为什么我的.gitignore文件不忽略特定文件?,git,gitignore,Git,Gitignore,为什么我的.gitignore文件不忽略特定文件 我需要忽略任何以:.metadata/开头的文件 我已经创建了一个git文件(.gitignore): 我在忽略文件中添加了以下文本: .metadata/* 但是,我的文件似乎仍以红色显示文件: ± |master ↑8 U:44 ?:22 ✗| → git status On branch master Your branch is ahead of 'origin/master' by 8 commits. (use "git pus

为什么我的.gitignore文件不忽略特定文件

我需要忽略任何以:.metadata/开头的文件

我已经创建了一个git文件(.gitignore):

我在忽略文件中添加了以下文本:
.metadata/*

但是,我的文件似乎仍以红色显示文件:

± |master ↑8 U:44 ?:22 ✗| → git status
On branch master
Your branch is ahead of 'origin/master' by 8 commits.
  (use "git push" to publish your local commits)
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   .metadata/.log
        modified:   .metadata/.mylyn/.tasks.xml.zip
        modified:   .metadata/.mylyn/tasks.xml.zip
        modified:   .metadata/.plugins/com.genuitec.eclipse.devstyle/recent.json
        modified:   .metadata/.plugins/com.genuitec.eclipse.monitor/myeclipse-usage.properties
±master↑8 U:44?:22✗| → git状态
论分行行长
您的分支机构比“原始/主分支机构”提前8次提交。
(使用“git push”发布本地提交)
未为提交而暂存的更改:
(使用“git add/rm…”更新将提交的内容)
(使用“git签出--…”放弃工作目录中的更改)
已修改:。元数据/.log
修改:.metadata/.mylyn/.tasks.xml.zip
修改:.metadata/.mylyn/tasks.xml.zip
修改:.metadata/.plugins/com.genuitec.eclipse.devstyle/recent.json
修改:.metadata/.plugins/com.genuitec.eclipse.monitor/myeclipse-usage.properties

要防止git“看到”
/metadata/
文件夹中的所有内容,请添加

/metadata/


到您的
.gitignore
文件。

要防止
/metadata/
文件夹中的所有内容被git“看到”,请添加

/metadata/


您的
.gitignore
文件。

您似乎将文件命名为
,gitignore
而不是
。gitignore
您似乎将文件命名为
,gitignore
而不是
。gitignore
根据您的问题,文件已经提交。 Git将继续报告已提交的被忽略文件的更改。在中,您应该通过以下操作从git repo中删除要忽略的文件:


具体来说:git-rm--cached-mylogfile.log目录:git-rm--cached-r mydirectory

根据您的问题,文件已经提交。 Git将继续报告已提交的被忽略文件的更改。在中,您应该通过以下操作从git repo中删除要忽略的文件:


具体来说:git-rm--cached mylogfile.log目录:git-rm--cached-r mydirectory

要忽略元数据文件夹,请使用
**/metadata/*
。(请确保使用git的1.8.2版或更高版本)

此外,您键入的
.gitignore
也有误。(将文件名从
,gitignore
更改为
.gitignore


您也可以签出此生成器->

以忽略元数据文件夹,使用
***/metadata/*
。(请确保使用git的1.8.2版或更高版本)

此外,您键入的
.gitignore
也有误。(将文件名从
,gitignore
更改为
.gitignore


您还可以检查此生成器->

是元数据/文件夹名称吗?是逗号而不是句点吗?可能重复的是元数据/文件夹名称吗?是逗号而不是句点吗?可能重复的是:git rm--目录的cached mylogfile.log:git rm--cached-r mydirectory具体地说是:git-rm--cached mylogfile.log目录:git-rm--cached-r mydirectory