The Messenger of Allah ﷺ established a pact of brotherhood between the Emigrants and the Helpers in our house.Someone said to him, "Did the Messenger of Allah ﷺ not say that there is no pact-making in Islam?"He replied, "The Messenger of Allah ﷺ established a pact between the Emigrants and the Helpers in our house," repeating it two or three times.
حدثنا مسدد حدثنا سفيان عن عاصم الأحول قال سمعت
حالف رسول الله ﷺ بين المهاجرين والأنصار في دارنا فقيل له أليس قال رسول الله ﷺ لا حلف في الإسلام فقال حالف رسول الله ﷺ بين المهاجرين والأنصار في دارنا مرتين أو ثلاثا
Bukhari narrated it in the Book of Holding Fast to the Book and the Sunnah, in the chapter on what the Prophet ﷺ mentioned and specified regarding the agreement of the scholars, etc., hadith no. 7340, and Muslim narrated it in the Book of the Virtues of the Companions, in the chapter on the Prophet's ﷺ fostering brotherhood between his companions, may Allah be pleased with them, hadith no. 2529, from the hadith of Asim al-Ahwal, with the same wording.