It is narrated from Ali bin Rabi'ah that he said: Sayyiduna Ali (may Allah be pleased with him) seated me behind him on his mount, then he went with me towards a graveyard. Then he raised his head towards the sky and supplicated: 'Allahumma ighfir li dhunubi, innahu la yaghfiru al-dhunuba ahadun ghayruka' (O Allah, forgive me my sins; indeed no one forgives sins except You). Then he turned towards me and smiled. I said: "O Commander of the Faithful! Why do you seek forgiveness from your Lord and then look at me and smile?" He said: "The Messenger of Allah (peace and blessings be upon him) seated me behind him (in the same way), then he went with me along one side of the Harrah. Then he raised his blessed head towards the sky and said: 'Allahumma ighfir li dhunubi, innahu la yaghfiru al-dhunuba ahadun ghayruka' (O Allah, forgive me my sins; indeed no one forgives sins except You). Then he (peace and blessings be upon him) turned towards me and smiled. I said: 'O Messenger of Allah (peace and blessings be upon him)! Why do you seek forgiveness from your Lord and then look at me and smile?' He (peace and blessings be upon him) said: 'I smiled because my Lord smiles, for He is pleased with and marvels at His servant who is certain that no one forgives sins except Him.'"
Abu Bakr bin Abi Shaybah and Ahmad bin Mani' recorded it, and this narration has already come in the chapter on his (peace and blessings be upon him) supplications.