Attaching a gear to a motor shaft

FYI, Attaching a gear to a motor shaft, see image: