The earliest published version is usually given as that in Playford's first edition of The English Dancing Master (1651). However, the melody appears earlier in William Ballet's Lute Book (1594) and therefore is probably older than the seventeenth century. It was already considered part of the established traditional repertoire in Playford's day. A reference can be found in A Handefull of Pleasant Delites (1584) in which mention is made of "An excellent Song of an outcast Lover, to 'All in a Garden green'".
The marrying of the "All in a garden green" poem to the air "Gathering Peascods" in William Ballet's book is due to Chappell in the mid-19th century (the first four bars of the tunes are identical).
It is printed in Chappell's Popular Music of the Olden Times (1859) and Karpeles & Schofield's A Selection of 100 English Folk Dance Airs (1951) where it appears under the dance title "The Maid in the Moon".