The lyrics appear to be primarily descended from an Irish folk song of the late 18th century called "The Unfortunate Rake", which also evolved into the cowboy ballad "The Streets of Laredo".
The Irish ballad shares a melody with the British sea-song "Spanish Ladies". The Bodleian Library, Oxford, has copies of a nineteenth-century broadside entitled "The Unfortunate Lad", which is a version of the British ballad.