According to World Wide Words, it originates from firemen doing speed competitions without carrying water.
The term run, more fully fire run, has for at least the past century been used by local fire departments in the USA for a call-out to the site of a fire. It was once common for fire departments or volunteer hose companies to give exhibitions of their prowess at carnivals or similar events. [...] These competitions had fairly standard rules, of which several examples appear in the press of this period, such as in the Olean Democrat of 2 August 1888: “Not less than fifteen or more than seventeen men to each company. Dry run, standing start, each team to be allowed one trial; cart to carry 350 feet of hose in 50 foot lengths ...”.
These reports show that a dry run in the jargon of the fire service at this period was one that didn’t involve the use of water, as opposed to a wet run that did. In some competitions there was a specific class for the latter, one of which was reported in the Salem Daily News for 6 July 1896: “The wet run was made by the Fulton hook and ladder company and the Deluge hose company. The run was made east in Main street to Fawcett’s store where the ladders were raised to the top of the building. The hose company attached [its] hose to a fire plug and ascending the ladder gave a fine exhibition.”
It’s clear that the idea of a dry run being a rehearsal would very readily follow from the jargon usage, though it first appears in print only much later.
Edit: found the citation from 1672, from Andrew Marvell’s The Rehearsal Transpros'd:
Two or three brawny Fellows in a
Corner, with meer Ink and
Elbow-grease, do more Harm than an
Hundred systematical Divines with
their sweaty Preaching.
It's also defined in B.E.'s A New Dictionary of the Terms Ancient and Modern of the Canting Crew, in its several tribes, of gypsies, beggers, thieves, cheats, &c. with an addition of some proverbs, phrases, figurative speeches, &c., c.1698:
Elbow-greaſe, a deriſory term for
Sweat. It will coſt nothing but a
little Elbow-grease ; in a jeer to one
that is lazy, and thinks much of his
Labour.
I found no earlier mentions than senderle, but here are some useful references. These are the earliest references I could find, and helpfully, they are also dictionary definitions.
The Online Etymology Dictionary says
Phrase elbow grease "hard rubbing" is
attested from 1670s, from jocular
sense of "the best substance for
polishing furniture."
There's a similarly colourful definition in Francis Grose's 1785 A Classical Dictionary of the Vulgar Tongue:
ELBOW GREASE, labour, elbow grease
will make an oak table shine.
(The rest of this dictionary is interesting too!)
Also, very pertinent to the question, here's The Royal Dictionary, French and English, and English and French by Abel Boyer in 1729:
Elbow-grease, (or Pains) Rude travail.
Rude travail is French for rough work. There's no entry for "l'huile de coude" in the French side.
And in John S. Farmer and W.E. Henley's 1905 A Dictionary of Slang and Colloquial English:
Elbow-grease. Energetic and continuous
manual labour : e.g. Elbow-grease is
the best furniture oil : Fr., huile de
bras or de poignet ; du foulage
(1779).
French huile de bras or de poignet is oil of the arm, wrist which is quite close. I think du foulage is fulling, the manual scouring and milling of cloth.
The earliest French reference I could "l'huile de coude" helpfully explains the term. In Jean Humbert's 1852 Nouveau Glossaire Genevois: Volume 1 (New Geneva Glossary):
Dans le langage badin des domestiques
et des maîtresses, l'huile de coude,
c'est le frottage, c'est-à-dire : Le
travail de la servante qui frotte.
Ces meubles, Madame, ne veulent pas
devenir brillants. — C'est que, ma
mie, tu y as sans doute économisé
l'huile de coude; c'est-à-dire : Tu as
trop ménagé ton bras et tes forces.
A rough translation:
In the playful language of servants
and masters, elbow grease is rubbing,
i.e. the work of the maid
who scrubs. This furniture, Madam,
does not want to shine. - My dear,
that is because you have undoubtedly
skimped on the elbow grease. In other
words, you have conserved both your arm and
your strength.
These references also suggest that "l'huile de coude" is an anglicisme.
Best Answer
An online search suggests that the expression you ask about may have been patterned on an earlier children's schoolyard (or lunchroom) expression with a very different meaning:
(often rendered as "No butts, no cuts, no coconuts"), where cuts refers to "cutting in line" and butts to "butting in [line]."
Native U.S. English speakers may be familiar with the warning cry "No cuts!" in elementary school and middle school lunchroom lines. In this parlance, cuts referring to the practice of a kid coming late to the line and joining a friend who has already been standing in line for some time, ahead of others who have also been standing in line and don't appreciate being delayed further by line-jumping latecomers. The jingle-like longer phrase turns the warning into a stylized chant.
Google Books searches yield a meager supply of these various phrases in action. First occurrences of the various forms appear in this order: an instance of "No Cuts, No Butts, No Coconuts" as a song title from 1999; an instance of "No Buts, No Cuts, No Coconuts!" as a children's book title from 2008; an instance of "No cuts, no buts, no coconuts" in Wreck-It Ralph (2012); and an example of "No ifs, no buts, no coconuts" from Evil is Taking Over the Establishment - Origins (2014).
The butts versus buts issue isn't something you asked about, but it seems to me that in the case of the no-cutting-in-line chant, the butts spelling makes more sense—whereas in the no-ifs-or-buts saying, buts is clearly the intended word.
In an extended discussion of "No cuts, no buts, no coconuts," Barry Popik's Big Apple site locates a first instance from the TV show Hey Arnold! from 1997. (Note that the example is spoken not written, so the spelling but is attributive. In fact, Popik's discussion doesn't address the buts/butts issue at all, nor does it acknowledge the existence of the "no ifs, no buts, no coconuts" variant.
UPDATE (June 3, 2017): I should mention two other confirmed early occurrences of related phrases. One is an instance of "no ifs, no buts, no cuts" from 1999 (probably) in Legal Action: The Bulletin of the Legal Action Group, where the meaning might be read as "no arguing or equivocating—cutting is not allowed"; the other is a much later instance, from Acid (2008), which gives the expression as "no buts no cuts, no alligator guts"—a retort by one juvenile character to another, who has just uttered the one-word objection, "But."