Yes, but you place a .gitignore with:
inside the folder you want to keep?
git add folder
And only the .gitignore will get inserted in the repo.
This is the best way i’ve found to add a folder without needing for special files and with support already built-in in git (at least on the versions that allow .gitignore files on subfolders of the project).