19th century, of northern German origin. Probably a minced oath/veiled use of a phrase like o Gott (“oh God!”), compare oh God.[1] Or, an extended form of (the presumably imitative) ih (“ew, yuck”) possibly influenced by the former.
igitt!