If your code is public then what does it matter? If it's not then you should be protecting it like any other sensitive information.
You can unintentionally expose your repository by deploying .git by mistake.
If your code is public then what does it matter? If it's not then you should be protecting it like any other sensitive information.