.gitignore不忽略文件夹 [英] .gitignore not ignoring folder
问题描述
我在Laravel中有一个项目,并且在公共目录中有一个论坛,我不想将其推送到存储库中,所以我用.gitignore编写:
I have a project in Laravel and I have forum in public directory which I don't want to push it to repository, so I write in .gitignore:
### Laravel ###
vendor/
node_modules/
# Laravel 5 & Lumen specific
bootstrap/cache/
.env.*.php
.env.php
.env
# SMF
public/forum/
# Rocketeer PHP task runner and deployment package. https://github.com/rocketeers/rocketeer
.rocketeer/
但是,该条目仍显示为 Git状态
这是我的树:
+ ...
+公共
++论坛
+++ ...
+ ...
问题出在哪里?
However, the entry still appears in Git status
Here is my tree with it:
+...
+ public
++ forum
+++...
+...
Where is the problem?
目录结构
Git状态
推荐答案
问题是此文件夹已在您的索引中(您早些时候提交了它).对索引中文件的更改将始终处于"git状态".只有该文件夹中的新文件将被忽略.
The problem is that this folder is already in your index (you committed it at an earlier moment). Changes to files in the index will always be in "git status". Only new files in that folder will be ignored.
要修复它.看到我的答案 https://stackoverflow.com/a/38304114/2274140
To fix it. See my answer on https://stackoverflow.com/a/38304114/2274140
这篇关于.gitignore不忽略文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!