How would git know that it's a password/key/whatever?
It might not catch everything all the time - since humans are pretty creative when it comes to fucking things up - but I bet it would be pretty effective. Certainly more effective than what we have now. Then if it can keep learning going forward, all the better, eh.
In comparison Gmail doesn't catch all cases either, if you say something like "here are" instead of I've attached it misses it.
Passwords, look for variables with the name password, passwd assigned strings.
Like Gmails attachment, it'll get stuff wrong, just make it easy to continue on.