Musnad Ahmad 930
It was narrated from `Ali bin Rabee`ah:
`Abdur-Razzaq said. Someone who saw `Ali when he rode told me: When he put his foot in the stirrup, he said: Bismillah (in the Name of Allah). When he got on it, he said: Al-Hamdu Lillah (praise be to Allah). Then he said: `Glory be to the One Who has placed this (transport) at our service and we ourselves would not have been capable of that, and to our Lord is our final destiny [az-Zukhruf 43:13-14]`. Then he said Al-hamdu Lillah three times and Allahu Akbar three times, then he said: O Allah, there is no god but You. I have wronged myself, so forgive me; no one forgives sins but You. Then he smiled, and it was said: What made you smile, O Ameer al-Mu`mineen? He said: I saw the Messenger of Allah     (ﷺ) do what I have done and say what I have said, then he smiled and we said: What made you smile, O Messenger of Allah (ﷺ)? He said: `I was amazed at the slave when he said there is no god but You. I have wronged myself, so forgive me; no one forgives sins but You,” and he knows that no one forgives sins but He.”
حَدَّثَنَا عَبْدُ الرَّزَّاقِ، حَدَّثَنَا مَعْمَرٌ، عَنْ أَبِي إِسْحَاقَ، عَنْ عَلِيِّ بْنِ رَبِيعَةَ، قَالَهُ مَرَّةً قَالَ عَبْدُ الرَّازِقِ وَأَكْثَرُ ذَاكَ يَقُولُ أَخْبَرَنِي مَنْ شَهِدَ عَلِيًّا حِينَ رَكِبَ فَلَمَّا وَضَعَ رِجْلَهُ فِي الرِّكَابِ قَالَ بِسْمِ اللَّهِ فَلَمَّا اسْتَوَى قَالَ الْحَمْدُ لِلَّهِ ثُمَّ قَالَ ‏{‏سُبْحَانَ الَّذِي سَخَّرَ لَنَا هَذَا وَمَا كُنَّا لَهُ مُقْرِنِينَ ‏.‏ وَإِنَّا إِلَى رَبِّنَا لَمُنْقَلِبُونَ‏}‏ ثُمَّ حَمِدَ ثَلَاثًا وَكَبَّرَ ثَلَاثًا ثُمَّ قَالَ اللَّهُمَّ لَا إِلَهَ إِلَّا أَنْتَ ظَلَمْتُ نَفْسِي فَاغْفِرْ لِي إِنَّهُ لَا يَغْفِرُ الذُّنُوبَ إِلَّا أَنْتَ ثُمَّ ضَحِكَ قَالَ فَقِيلَ مَا يُضْحِكُكَ يَا أَمِيرَ الْمُؤْمِنِينَ قَالَ رَأَيْتُ النَّبِيَّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ فَعَلَ مِثْلَ مَا فَعَلْتُ وَقَالَ مِثْلَ مَا قُلْتُ ثُمَّ ضَحِكَ فَقُلْنَا مَا يُضْحِكُكَ يَا نَبِيَّ اللَّهِ قَالَ الْعَبْدُ أَوْ قَالَ عَجِبْتُ لِلْعَبْدِ إِذَا قَالَ لَا إِلَهَ إِلَّا أَنْتَ ظَلَمْتُ نَفْسِي فَاغْفِرْ لِي إِنَّهُ لَا يَغْفِرُ الذُّنُوبَ إِلَّا أَنْتَ يَعْلَمُ أَنَّهُ لَا يَغْفِرُ الذُّنُوبَ إِلَّا هُوَ‏.‏