there are at least three ways to ignore files in git:
these settings are stored in the metadata of your git installation / the current clone. they are not transferred when creating a new clone and are thus not shared between users.
however, people noticed that often they all want to ignore the same files and they would like to exchange the list of ignored files. this list changes with time, so it is reasonable to put it under version control. and, as one principle of unix, everything is a file and plaintext if possible, you end up with a .gitingore file. now that you have a repository and a file that needs to be version controlled and exchanged between all the users of the repository --- why not simply add the file to the repository? that way you need no special logic and no hidden configuration files, everything just works.
and this is the third way to ignore files in git:
- ignore them via a .gitignore file
in my personal opinion .gitignore files are one of the things that make git awesome.
PS: to elaborate a bit more on the "why is it not there by default": i do not answer the question directly, but thinking about these questions might help:
- why is there no readme added by default? each and every repo should have one!
- same thing for licence? each and every repo should have one!
- ...
all these things are strongly recommended and best practices, but from a technical point of view you can do without. and git has a tendency to do only the bare minimum to make things work. defaults in git strive to be reasonable but minimalstic. this is great but sometimes it makes it harder for beginners.