Ibn Jurayj reported,

With this chain of narration, "Whoever has eaten from this tree," meaning garlic, "let him not come near our mosque." He did not mention onions or leeks.

Muslim 1255

Sahih

و حدثنا إسحق بن إبراهيم أخبرنا محمد بن بكر قال ح و حدثني محمد بن رافع حدثنا عبد الرزاق قالا جميعا أخبرنا

ابن جريج

بهذا الإسناد من أكل من هذه الشجرة يريد الثوم فلا يغشنا في مسجدنا ولم يذكر البصل والكراث

مسلم 1255صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Mosques and places of prayer
Chapter
Prohibition on those who have eaten garlic, onions, leeks, or similar from attending the masjid
Numbering
Darussalam 1255
Muslim 1255