Sayyiduna Abu Sa'id Khudri (may Allah be pleased with him) narrates: In the presence of the Prophet (peace and blessings of Allah be upon him), garlic and onion were mentioned. It was submitted: O Messenger of Allah (peace and blessings of Allah be upon him)! Garlic has a stronger odor among them, should we consider it forbidden? The Prophet (peace and blessings of Allah be upon him) said: You people may eat it, but whoever among you eats it should not come near our mosque until its smell has vanished.
Hadith Referenceصحیح ابن حبان / كتاب الصلاة / 2085
Hadith Gradingفضيلة الشيخ الإمام محمد ناصر الدين الألبانيصحيح - «الصحيحة» (2032).فضيلة الشيخ العلّامة شُعيب الأرناؤوطأبو النجيب يقال: اسمه ظليم، روى عن ابن عمر وأبي سعيد، ولم يرو عنه غير بكر بن سوادة، وأورده المؤلف في "الثقات" 5/ 575.