.gitignore and Unity not working properly

Hello everyone,

I am currently working on a 2d game in Unity, and since I alternate between using my desktop and my laptop I have set a github repository to save my changes and work on either computer. For the most part it works perfectly, but there are a couple of things that I have been trying to fix forever but no matter what I try I can’t get it right, that is why I am posting here to hopefully find an answer.

Problem 1: I have made a prefab and saved it, but when I committed changes the prefab file wasn’t on the other computer. Note: Prefab file is under Assets, and any other folder in assets was carried.

Problem 2: Every time I want to commit there are +1000 files from library, which I have found out online that I shouldn’t be committing to the repository, that is why I want to ignore it but no matter how I place it in the .gitignore it is still there.

Attempted Solution 1: Used other people’s .gitignores. Added /[Ll]ibrary/ and [Ll]ibrary/, still didn’t work.

Attempted Solution 2: Ignored everything except assets, settings, packages and the gitignore itself, it still doesn’t work. I will attach how my folders and my .gitignore look so that folks can take a look.

MY .GITIGNORE

Ignore everything

/*
/*/

Inverse ignore some stuff

!/Assets/
!/ProjectSettings/
!/Packages/
!.gitignore

OS Stuff

.DS_Store
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
$RECYCLE.BIN/
Desktop.ini

MY FILES

P.S.: Could it be because under Github I have a file called “Lolo” (my game) and then inside it, with README and .gitignore I have another file named “Lolo” which includes all of the unity files?