The Kipling Society's notes to his book Weland's Sword also say:
[Page 8, line 10] By Oak, Ash, and Thorn the formula may derive from the ballad of `Glasgerion' (Percy, Reliques of Ancient Poetry, 3rd ser., Bk. 1), where the hero:
`swore a full great othe
By oake and ashe and thorne'.
Philip Holberton has suggested that Kipling may also have found it in Charles Kingsley’s novel Westward Ho! In chapter 2: 'Sir Richard swore a great and holy oath, like Glasgerion’s, "by oak and ash and thorn.” '. He points out that Kipling certainly knew the book by 1893 when he wrote “An English School”, see Land and Sea Tales page 255, line 15.