"sat a gee"

Does anyone know the origin of this phrase? It was used by W.S.Gilbert in the Major General's song in Pirates of Penzance.

"Gee" and "haw" are (were? I've never sat a gee) commands to horses, and "gee" was a nickname for a horse in Gilbert's time. So the Major-General has never ridden a horse.