It is narrated from Sayyiduna Jabir (may Allah be pleased with him) that the Prophet (peace and blessings be upon him) said: Whoever eats onions or garlic should not come near our mosques; he should sit in his house.
Hadith Referenceمسند احمد / مسند المكثرين من الصحابة / 15299