This is how I have held gears to be machined, The recess was just under size but aloud for a nice push in fit, and with light cuts the gear did not move
You could drill and tap a hole for a grub screw in to the side so a pointed grub screw could be very lightly screwed down so the gear will not...