Abdullah bin Umar reported,

The Messenger of Allah ﷺ set out to perform Umrah, but the disbelievers of Quraysh prevented him from reaching the House. So he sacrificed his offering and shaved his head at Hudaybiyah, and he made a treaty with them that he would perform Umrah the following year, that he would not carry any weapons against them except swords, and that he would not remain in Mecca longer than they wished.The next year, he performed Umrah and entered Mecca according to the terms he had agreed upon with them. When he had stayed there for three days, they ordered him to leave, and he departed.

Azami 13330

Sahih

عن ابن عمر

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

الأعظمي 13330صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Tafsir of the great Quran
Chapter
Tafsir of Surah Fath
Section
His saying, "Allah has certainly fulfilled for His Messenger the vision in truth. You will surely enter Masjid al-Haram, if Allah wills, in safety, with your heads shaved and hair shortened, not fearing. He knew what you did not know, and He made besides that a near victory."
Numbering
Jami al-Kamil 13330 (2nd edition)