Sahih al-Bukhari, Book 10, Hadith 244 (Bukhari 832)

Narrated Ibn `Umar:

During the holy battle of Khaibar the Prophet (ﷺ) said, "Whoever ate from this plant (i.e. garlic) should not enter our mosque."