However, similar quotes are ascribed to a variety of people according to Quote Investigator, S/he lists four basic versions, and assigns them as follows
A man may do an immense deal of good, if he does not care who gets the credit for it: In a diary entry for 1863, ascribed to a Jesuit Priest named Father Strickland.
This was the opportunity for a man who likes to do a good thing in accordance with the noble maxim … “Never mind who gets the credit.” Published 1896, and the phrase “Never mind who gets the credit” was dubbed the noble maxim of Edward Everett Hale.
The way to get things done is not to mind who gets the credit of doing them: Published 1905, ascribed to Benjamin Jowett, though later reassigned by one of the authors to a "Jesuit Father".
There is no limit to what a man can do who does not care who gains the credit for it: Used by Charles Edward Montague in 1906, who didn't take credit for it, ascribing it to a friend who often used it.
For a full discussion with references, see http://quoteinvestigator.com/2010/12/21/doing-good-selfless/.