How to tell dropbox to ignore git files?

On Linux Dropbox has a client (dropbox) and a deamon (dropboxd).

The client has the exclude command, which you can use to exclude directories. E.g. to exclude node_modules from Dropbox you can enter dropbox exclude add ./node_modules

dropbox help exclude will print the help information:

dropbox exclude [list]
dropbox exclude add [DIRECTORY] [DIRECTORY] ...
dropbox exclude remove [DIRECTORY] [DIRECTORY] ...

"list" prints a list of directories currently excluded from syncing.
"add" adds one or more directories to the exclusion list, then resynchronizes Dropbox.
"remove" removes one or more directories from the exclusion list, then resynchronizes Dropbox.
With no arguments, executes "list".
Any specified path must be within Dropbox.

Dropbox has a Selective Sync feature that you can look to configure

Couple of tools that I found, that talk about achieving this via config files-

  1. Dropboxfilter
  2. Dropboxignore

Dropbox seems to be working on a feature that would finally solve the issue https://help.dropbox.com/en-us/files-folders/restore-delete/ignored-files

But until then check out this solution here: https://stackoverflow.com/a/60104539/1768033 Which works way better than selective sync.