Anas bin Malik reported,

The site of the Prophet's ﷺ mosque belonged to the Banu al-Najjar. It contained palm trees and graves of polytheists. The Prophet ﷺ said to them, "Name me a price for it."They replied, "We will not take any price for it."The Prophet ﷺ worked on building it while they handed him the materials, and he was saying, "Indeed, true life is the life of the Hereafter, so forgive the Ansar and the Muhajirun."The narrator said, before the mosque was built, the Messenger of Allah ﷺ used to pray wherever the time of prayer overtook him.

Ahmad 12178

Sahih

حدثنا وكيع حدثنا حماد بن سلمة عن أبي التياح

عن أنس بن مالك قال

كان موضع مسجد النبي ﷺ لبني النجار وكان فيه نخل وقبور المشركين فقال لهم النبي ﷺ ثامنوني به فقالوا لا نأخذ له ثمنا وكان النبي ﷺ يبنيه وهم يناولونه وهو يقول ألا إن العيش عيش الآخره فاغفر للأنصار والمهاجره قال وكان رسول الله ﷺ يصلي قبل أن يبنى المسجد حيث أدركته الصلاة

أحمد 12178صحيح
Contents
Reference
Commentary
Ayat
Collection
Musnad Ahmad
Book
Anas bin Malik
Numbering
Darussalam 12178
Ahmad 12178