Yes, you can comment lines out of Git config files using # or ;.
From the documentation:
Syntax
The syntax is fairly flexible and permissive; whitespaces are mostly ignored. The
#and;characters begin comments to the end of line, blank lines are ignored.