Program it with the key on, somewhere away from your garage. Hold your transmitter close and push buttons as directed in the manual.
I use the left hand button for my garage door opener, the outer right button for gate exit and inner button for gate entry, works great! Range is not all that wonderful though, but is adequate.