Sahih Muslim – Hadith No : 1276

Ibn ‘Umar reported: The Messenger of Allah (may peace be upon him) said during the battle of Khaybar: He who ate of this plant, i. e. garlic, should not come to the mosques. In the narration of Zubair, there is only a mention of” battle” and not of Khaybar.

Hadith In Arabic Text :

حدثنا محمد بن المثنى، وزهير بن حرب، قالا حدثنا يحيى، – وهو القطان – عن عبيد الله، قال أخبرني نافع، عن ابن عمر، أن رسول الله صلى الله عليه وسلم قال في غزوة خيبر ‏”‏ من أكل من هذه الشجرة – يعني الثوم – فلا يأتين المساجد ‏”‏ ‏.‏ قال زهير في غزوة ‏.‏ ولم يذكر خيبر ‏.‏

Chapter : The Book of Mosques and Places of Prayer – كتاب الْمَسَاجِدِ وَمَوَاضِعِ الصَّلاَةِ