(Imām Bukhārī narrates): Musaddad narrated to us, he said: Yahya narrated to us from Ubaidullah, he said: Nafi' narrated to me from Ibn Umar, may Allāh be pleased with them both, that
the Prophet ﷺ said during the battle of Khaybar: Whoever eats from this tree, that is garlic, should not come near our mosque.
حَدَّثَنَا مُسَدَّدٌ، قَالَ حَدَّثَنَا يَحْيَى، عَنْ عُبَيْدِ اللَّهِ، قَالَ حَدَّثَنِي نَافِعٌ، عَنِ ابْنِ عُمَرَ ـ رضى الله عنهما ـ أَنَّ النَّبِيَّ صلى الله عليه وسلم قَالَ فِي غَزْوَةِ خَيْبَرَ " مَنْ أَكَلَ مِنْ هَذِهِ الشَّجَرَةِ ـ يَعْنِي الثُّومَ ـ فَلاَ يَقْرَبَنَّ مَسْجِدَنَا ".
Reference: Sahih Al Bukhari 853