Sahih Muslim Book 45, Hadith 119
A hadith like this has been reported on the authority of Abu Huraira through another chain of transmitters.
This hadith has been transmitted on the authority of Abu Zinad with a slight variation of wording.
I heard Abu Huraira as saying that he heard Allah's Messenger (ﷺ) as saying: O Allah, Muhammad is a human being. I lose my temper just as human beings lose temper, and I have held a covenant with Thee which Thou wouldst not break: For a believer whom I give any trouble or invoke curse or beat, make that an expiation (of his sins and a source of) his nearness to Thee on the Day of Resurrection.