.gitignore is not working as expected (this one)

I have a local folder /public/assets/images... that continues to be overwritten with the local copy once pushed to Digital Ocean. I have tried using varying paths in .gitignore all to no avail. It's gotten so out of hand it now looks like this:

node_modules

.svn

.env

**/.DS_Store

**/public/assets/images

*/public/assets/images

/public/assets/images

**/assets/images

*/assets/images

/assets/images

**/assets/images/news

*/assets/images/news

/assets/images/news

**/public/assets/images/news

*/public/assets/images/news

/public/assets/images/news

**/public/assets/images/profilePics

*/public/assets/images/profilePics

/public/assets/images/profilePics

**/assets/images/news

*/assets/images/news

**/assets/images/profilePics

*/assets/news

*public/assets/news/

**public/assets/news/

/public/assets/*

Strange that something on Git CLI goes smoothly and I'm bumping into this.

Anyone have any idea what I'm doing wrong?

.gitignore only deals with excluding files from git commits.

If you are using docker, use .dockerignore instead.

If using ftp you can set the files to exclude in the project settings.

@mebeingken

Can you not exclude an entire directory /path?

@mebeingken
Not using docker. I'll look into ftp thanks.

It's strange because even though the repo does not show updated, it in fact is each time I push. The contents of the folder go back to what I have local. Curiouser and curiouser.

You mean remote files that don't exist on local are deleted?

Do you happen to know if this behaviour only started to occur recently? There was an internal change some updates ago to speed up uploads.

@Apple

Exactly. Locally, the directory has only two files. I run the webapp and set test users' profile pics to x.png. Everything is stable - until the next git push. Then the contents of the folder are reset to local. I have the user upload folder set in settings to this seems very odd. It started happening in the last week or so and I have been fussing with it, finally got frustrated enough to make a post.

Thoughts?

Side note, uploaded images should live in the storage/uploads directory, according to your project settings

I name my folder "storage", and then create subfolders

Have you added the public/assets/images folder as the uploads folder in the project settings?
This should prevent the local folder being uploaded.

@Hyperbytes

I did, and it should; all to no avail.

I resolved the entire issue by saving images to S3; which is how it should have been done to start with. I was just trying to get something working thinking I'd switch later, but got stuck on the mystery that is this thread.

Anyways, problem solved in less than 30 minutes using S3 storage. It's more reliable, scalable, CDN feature - just better... and it leaves git out of it.

Thanks to anyone who provided input.

~Elle