Abu Hurairah (RA) reported: The Messenger of Allah (ﷺ) said: He who eats of this plant (garlic) should not approach our mosque and should not harm us with the odour of garlic.
Hadith ReferenceSahih Muslim / The Book of Mosques and Places of Prayer / Hadith: 562