صحیح ابن حبان
Ibn Hibban
كتاب الصلاة
Book of Prayer
باب المساجد - ذكر الزجر عن إتيان المساجد لآكل الثوم والبصل والكراث إلى أن تذهب رائحتها
Chapter on Mosques - Prohibition of entering mosques for those who eat garlic, onions, or leeks until the smell is gone.
2 hadith
Hadith 1644
Sayyiduna Jabir bin Abdullah (may Allah be pleased with them both) narrates this statement of the Prophet (peace and blessings of Allah be upon him): "Whoever eats this vegetable, meaning garlic, onion, or leek, should not come to our mosques, because the angels are bothered by that which bothers humans."
Hadith 1645
Sayyiduna Abu Huraira (may Allah be pleased with him) narrates this statement of the Prophet (peace and blessings be upon him): "Whoever eats from this tree should by no means cause us discomfort in our gatherings." By this, the Prophet (peace and blessings be upon him) meant garlic.