Leach saith Bitter Withy was first reported by Frank Sidgwick in "Notes and Queries" series 10 No. 83. (No date given - say c.1910) The legend is based on hagiographic literature. It was well-known & appears in religious & pictorial art. See GH Gerould, The Ballad of the Bitter Withy"
The text given (from "Notes and Queries") is much the one generally sung.