Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.gitignore not ignoring folder

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/

However, the entry still appears in Git status
Here is my tree with it:
+...
+ public
++ forum
+++...
+...
Where is the problem?

Directory structure enter image description here

Git status enter image description here

like image 534
Vertisan Avatar asked Aug 18 '16 09:08

Vertisan


2 Answers

In .gitignore add

public/forum

Run

git rm --cached -r public/forum
like image 166
KmasterYC Avatar answered Sep 21 '22 20:09

KmasterYC


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.

To fix it. See my answer on https://stackoverflow.com/a/38304114/2274140

like image 45
BartBog Avatar answered Sep 21 '22 20:09

BartBog