My assumption is that, in any context , it is not a good practice to keep libraries and packages in your source control.
For instance, I have downloaded the "Platformer set" asset and imported it into my Unity project. It goes by default into ./Assets, but I have moved it into ./Assets/Packages, folder which I have added to my repository's .gitignore file. This way I plan to differentiate custom assets (part of my source control) from public ones (which I plan to import on a second computer upon mapping the repository).
I have taken one of the tilesets in "Platformer set", sliced it, and created a tile palette.
Then I have used the tiles in the tile palette to edit a tilemap, building some platforms.
Finally, I delete the imported "Platformer set" found under ./Assets/Packages folder, since I would have the same result mapping my repository in a second computer (because ./Assets/Packages is not part of my source control).
My idea then would be to import the package again through the package manager, and move it to the right location. Unfortunately, at the very moment I delete the asset folder, the tilemap looses all the tiles related to that asset. Similar things would happen with animations created on imported asset's sprites, and many other types of assets.
So, long story short: which is the right way (if it exists) to be able to exclude Unity assets from your source control using Git, but avoiding messing up with your project files? I come from a C# application background where broken references remain there until you fix them, they don't dissappear.
Or should I keep the packages in the source control? A second developer mapping the Unity project with git would have these packages downloaded onto their machine as part of the mapped Unity project, even if they don't have them downloaded using their package manager in the first place (which makes you end up with a weird development environment, taking into account that the normal workflow is that you FIRST download them with the package manager into a common location in your PC and THEN you import them into your project).