"mindless, gung-ho patriot," 1878, picked up from the refrain of a music hall song written by G.W. Hunt, and sung by "Gilbert H. MacDermott" (1845-1901), supporting aggressive British policy toward Russia at a time of international tension. ("We don't want to fight, But by Jingo! if we do, We've got the ships, we've got the men, We've got the money too.")
As an asseveration, it was in colloquial use since 1690s, and is apparently yet another euphemism for Jesus, influenced by conjurer's gibberish presto-jingo (1660s). The frequent suggestion that it somehow derives from Basque Jinko "god" is "not impossible," but "as yet unsupported by evidence" [OED].