From the git grep manual:
Options:
-n, --line-number
Prefix the line number to matching lines.
Configuration:
grep.lineNumber
If set to true, enable -n option by default.
To turn on globally: git config --global grep.lineNumber true