Not if you use TruffleHog and GitGuardian.
The best solution is to plan ahead.
When I write a line of code, I have an automatic "red team" approach. I think "I'm a blackhat hacker. How do I leverage this line?"
Not a 100% guarantee, but it sure does help the result to be more secure.
In my experience, 99% of security is good old-fashioned horse sense.