I was present when Ali was brought a riding animal to mount. When he placed his foot in the stirrup, he said, "In the name of Allah," three times. Once he had settled upon its back, he said, "Praise be to Allah." Then he recited, "Glory be to Him who has subjected this to us, for we could never have done it by ourselves, and indeed to our Lord we shall return" [Zukhruf 43:13–14]. Then he said, "Praise be to Allah," three times, and "Allah is the greatest," three times, then, "Glory be to You, I have wronged myself, so forgive me, for none forgives sins but You." Then he laughed.I asked, "What made you laugh, Commander of the Faithful?"He replied, "I saw the Messenger of Allah ﷺ do exactly as I have done, and then he laughed. So I asked, 'What made you laugh, Messenger of Allah?' He said, 'Your Lord marvels at His servant when he says, My Lord, forgive me my sins, for none forgives sins but You.'"
حدثنا قتيبة حدثنا أبو الأحوص عن أبي إسحق
شهدت عليا أتي بدابة ليركبها فلما وضع رجله في الركاب قال بسم الله ثلاثا فلما استوى على ظهرها قال الحمد لله ثم قال {سبحان الذي سخر لنا هذا وما كنا له مقرنين وإنا إلى ربنا لمنقلبون} ثم قال الحمد لله ثلاثا والله أكبر ثلاثا سبحانك إني قد ظلمت نفسي فاغفر لي فإنه لا يغفر الذنوب إلا أنت ثم ضحك قلت من أي شيء ضحكت يا أمير المؤمنين قال رأيت رسول الله ﷺ صنع كما صنعت ثم ضحك فقلت من أي شيء ضحكت يا رسول الله قال إن ربك ليعجب من عبده إذا قال رب اغفر لي ذنوبي إنه لا يغفر الذنوب غيرك
Sourcing, sahih. Abu Dawud also narrated it in jihad, in the chapter on what a man says when he mounts, hadith 2602, from the hadith of Abu Ahwas with the same wording. Abu Ishaq explicitly stated that he heard it directly, as recorded by Bayhaqi, 5/252. Daraqutni criticized it for a defect that is not damaging, and it has many corroborating narrations.