Anas was asked about the garlic; he stated that the Messenger of Allah (ﷺ) had said: He…

Sahih Muslim Book 5 Hadith 88

Sahih Muslim #562

The Book of Mosques and Places of Prayer 5:88

Ibn Suhaib reported:

Anas was asked about the garlic; he stated that the Messenger of Allah (ﷺ) had said: He who eats of this plant (garlic) should not approach us and pray along with us.

Chapter: Prohibiting one who has eaten garlic, onions, or leeks, and other things that have an offensive odor from coming to the masjid, until that smell has gone away, and such a person should be expelled from the masjid

Grade: Sahih