No, it isn’t necessary to keep it private.
The secret key is not in git’s configs but in the GnuPG’s “keyring”, which is usually some file in your HOME. In theory it can also be in more secure locations, like hardware token, but I don’t know much about it.
The value in git config only instructs gpg which secret key to select.