كتاب الجهاد والسير
32  
The Book of Jihad and Expeditions
(44)
Chapter: The Battle of Al-Ahzab (The Confederates), also known as Al-Khandaq (The Ditch)
(44)
باب غَزْوَةِ الأَحْزَابِ وَهِيَ الْخَنْدَقُ ‏‏
Sahih Muslim 1804

It has been reported on the authority of Sahl b. Sa'd who said:

The Messenger of Allah (ﷺ) came to us while we were digging the ditch and were carrying the earth on our shoulders. (Seeing our condition), he said: O God, there is no life but the life of the Hereafter. So forgive Thou the Muhajirs and the Ansar.
حَدَّثَنَا عَبْدُ اللَّهِ بْنُ مَسْلَمَةَ الْقَعْنَبِيُّ، حَدَّثَنَا عَبْدُ الْعَزِيزِ بْنُ أَبِي حَازِمٍ، عَنْ أَبِيهِ، عَنْ سَهْلِ بْنِ سَعْدٍ، قَالَ جَاءَنَا رَسُولُ اللَّهِ صلى الله عليه وسلم وَنَحْنُ نَحْفِرُ الْخَنْدَقَ وَنَنْقُلُ التُّرَابَ عَلَى أَكْتَافِنَا فَقَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ اللَّهُمَّ لاَ عَيْشَ إِلاَّ عَيْشُ الآخِرَةِ فَاغْفِرْ لِلْمُهَاجِرِينَ وَالأَنْصَارِ ‏"‏ ‏.‏
Reference : Sahih Muslim 1804
In-book reference : Book 32, Hadith 154
USC-MSA web (English) reference : Book 19, Hadith 4444
  (deprecated numbering scheme)