The story
From the common use of clogs by manual workers in north England and following the style of similar phrases which have been attested since 1700. The particular phrasing is perhaps of Lancashire origin. Compare shirtsleeves to shirtsleeves in three generations.
Etymology from Wiktionary, CC BY-SA 4.0.