The story
Unknown. Attested since the 1500s, suggested by one theory to be a minced oath of shit end of the stick, as an 1840s cite uses crappy, but this theory is unlikely. Possibly also derived from a previous literal meaning, as wrong end of the stick is even older, though the precise literal meaning is unclear.
Etymology from Wiktionary, CC BY-SA 4.0.