"Moke" is a term used in the British Isles as slang for "donkey", and probably has some regrettable racist connotations.
Cecil Sharp believed the tune to be a variant of Shule Agra, and Hoo-roo may even be reminiscent of "Shule Agra"; the reference to "the railroad" a memory of Poor Paddy Works on the Railway. Sharp identifies African American influence in both words and melody, and Irish connections may be an incidental attempt to whitewash this connection. This version came to him from John Short of Watchet and Sharp arranged it for piano in 1914.
Stan Hugill is the other chief source, and he provided several additional verses. Hugill wrote that the song "originated by the Negro and Irish work-gangs who laboured on the Iron Road. Some of these songs eventually arrived at sea and [this] was certainly one of them."