Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove storage folder from .gitignore file?

Tags:

git

gitignore

My .gitignore file contains one big line:

/node_modules/public/hot/public/storage/storage/*.key/vendor/.idea/.vagrantHomestead.jsonHomestead.yamlnpm-debug.logyarn-error.log.env

Since I have a folder in my storage which contains all icons/images that are used in my website, I want that folder to be uploaded to github as well. Sadly it seems the whole public/storage folder is in gitignore so it's getting ignored.

Little side question - why does my gitignore file has a blank file name when looking at it in the root folder?

like image 350
Bobimaru Avatar asked Nov 30 '25 10:11

Bobimaru


2 Answers

I think your .gitignore file is not correct then you should have one entry per line.

It looks a bit that you don't have the new line character in your file. If you need that folder in your project then remove that line from your file and add the folder.

https://git-scm.com/docs/gitignore

like image 112
René Höhle Avatar answered Dec 02 '25 01:12

René Höhle


So ever /entry should be on a new line?

Yes.

How can I know whether /public/storage/storage should be split into /public/storage and /storage or /public, /storage and /storage?

Each entry is relative to where the .gitignore is in the repo.
A leading slash matches the beginning of the pathname. For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c" (again, relative to where the .gitignore is).

In order to check if your .gitignore does work, check the output of:

git check-ignore -v -- a/file/in/the/repo
like image 21
VonC Avatar answered Dec 02 '25 00:12

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!