This is a capstan chanty, possibly tied to the Irish diaspora following the potato famine between 1846 and 1850. It shares the same melody as the sea shanty "Leave Her, Johnny, Leave Her". Which song came first is not definitively known.
This has been recorded by Roberts & Barand, The Irish Rovers and others.