Reference : Hisn al-Muslim 250

وَقَالَ صلى الله عليه وسلم: مَنْ قَالَ (أَسْتَغْفِرُ اللَّهَ الْعَظيمَ الَّذِي لاَ إِلَهَ إِلاَّ هُوَ الْحَيُّ القَيّوُمُ وَأَتُوبُ إِلَيهِ)، غَفَرَ اللَّهُ لَهُ وَإِنْ كَانَ فَرَّ مِنَ الزَّحْفِ.
Allah's Messenger (ﷺ) said: Whoever says:
Astaghfirullāha ‘l-'Aẓīm
alladhi lā ilāha illā huwa ‘l-ḥayyul-Qayyūm 
wa atūbu ilayh.


Allah's Messenger (ﷺ) said: Whoever says:

I seek the forgiveness of Allah the Mighty, Whom there is none worthy of worship except Him, the Living, the Eternal, 
and I repent to Him, 
Allah will forgive him even if he has deserted the army's ranks.

Reference:
Abu Dawud 2/85, At-Tirmidhi 5/569, and Al-Hakim who declared it authentic 
and Ath-Thahabi agreed with him 1/511. Al-Albani graded it authentic in 
Sahih At-Tirmidhi 3/182. See also Jami'ul-'Usool li-'Ahdaith Ar-Rasool 4/ 
389-90 checked by Al-Arna'ut.

Chapter: Seeking forgiveness and repentance