.gitignore不忽略文件夹 [英] .gitignore not ignoring folder

查看:844
本文介绍了.gitignore不忽略文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在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屋!

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