Some garage doors open by keypad rather than by a remote. We’d say these keypads can, in some instances, be safer than a physical garage door opener—but they aren’t infallible.
For instance, someone can observe you entering the passcode. Or figure out what your code is by the most worn-down keys. Most importantly, you either have to keep switching the password or get a keypad that allows throwaway guest codes. Otherwise, keeping it a secret could be difficult.
And yes, to keep your garage secure, the code must be secret. You shouldn’t give it to houseguests or your kids’ friends, even if they’re trustworthy. They might let the code slip to someone else who isn’t trustworthy.