كتاب الْمَسَاجِدِ وَمَوَاضِعِ الصَّلاَةِ
5  
The Book of Mosques and Places of Prayer
(17)
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
(17)
باب نَهْىِ مَنْ أَكَلَ ثُومًا أَوْ بَصَلاً أَوْ كُرَّاثًا أَوْ نَحْوَهَا عَنْ حُضُورِ الْمَسْجِدِ ‏‏
Sahih Muslim 564 a

Jabir reported:

The Messenger of Allah (ﷺ) forbade eating of onions and leek. When we were overpowered by a desire (to eat) we ate them. Upon this he (the Holy Prophet) said: He who eats of this offensive plant must not approach our mosque, for the angels are harmed by the same things as men.
حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، حَدَّثَنَا كَثِيرُ بْنُ هِشَامٍ، عَنْ هِشَامٍ الدَّسْتَوَائِيِّ، عَنْ أَبِي الزُّبَيْرِ، عَنْ جَابِرٍ، قَالَ نَهَى رَسُولُ اللَّهِ صلى الله عليه وسلم عَنْ أَكْلِ الْبَصَلِ وَالْكُرَّاثِ ‏.‏ فَغَلَبَتْنَا الْحَاجَةُ فَأَكَلْنَا مِنْهَا فَقَالَ ‏ "‏ مَنْ أَكَلَ مِنْ هَذِهِ الشَّجَرَةِ الْمُنْتِنَةِ فَلاَ يَقْرَبَنَّ مَسْجِدَنَا فَإِنَّ الْمَلاَئِكَةَ تَأَذَّى مِمَّا يَتَأَذَّى مِنْهُ الإِنْسُ ‏"‏ ‏.‏
Reference : Sahih Muslim 564a
In-book reference : Book 5, Hadith 90
USC-MSA web (English) reference : Book 4, Hadith 1145
  (deprecated numbering scheme)
Sahih Muslim 564 b

Jabir reported:

The Messenger of Allah (ﷺ) said: He who eats garlic or onion should remain away from us or from our mosque and stay in his house. A kettle was brought to him which had (cooked) vegetables in it, He smelt (offensive) odour in it. On asking he was informed of the vegetables (cooked in it). He said: Take it to such and such Companion. When he saw it, he also disliked eating it. (Upon this). he (the Holy Prophet) said: You may eat it, for I converse wkh one with whom you do not converse.
وَحَدَّثَنِي أَبُو الطَّاهِرِ، وَحَرْمَلَةُ، قَالاَ أَخْبَرَنَا ابْنُ وَهْبٍ، أَخْبَرَنِي يُونُسُ، عَنِ ابْنِ شِهَابٍ، قَالَ حَدَّثَنِي عَطَاءُ بْنُ أَبِي رَبَاحٍ، أَنَّ جَابِرَ بْنَ عَبْدِ اللَّهِ، قَالَ - وَفِي رِوَايَةِ حَرْمَلَةَ وَزَعَمَ أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏"‏ مَنْ أَكَلَ ثُومًا أَوْ بَصَلاً فَلْيَعْتَزِلْنَا أَوْ لِيَعْتَزِلْ مَسْجِدَنَا وَلْيَقْعُدْ فِي بَيْتِهِ ‏"‏ ‏.‏ وَأَنَّهُ أُتِيَ بِقِدْرٍ فِيهِ خَضِرَاتٌ مِنْ بُقُولٍ فَوَجَدَ لَهَا رِيحًا فَسَأَلَ فَأُخْبِرَ بِمَا فِيهَا مِنَ الْبُقُولِ فَقَالَ ‏"‏ قَرِّبُوهَا ‏"‏ ‏.‏ إِلَى بَعْضِ أَصْحَابِهِ فَلَمَّا رَآهُ كَرِهَ أَكْلَهَا قَالَ ‏"‏ كُلْ فَإِنِّي أُنَاجِي مَنْ لاَ تُنَاجِي ‏"‏ ‏.‏
Reference : Sahih Muslim 564b
In-book reference : Book 5, Hadith 91
USC-MSA web (English) reference : Book 4, Hadith 1146
  (deprecated numbering scheme)
Sahih Muslim 564 c

Jabir b. 'Abdullah reported the Messenger of Allah (ﷺ) mying:

He who eats of this (offensive) plant, i. e garlic, and sometirres he said: He who eats onion and garlic and leek, should not approach our mosque for the angels are harmed by the same things as the children of Adam.
وَحَدَّثَنِي مُحَمَّدُ بْنُ حَاتِمٍ، حَدَّثَنَا يَحْيَى بْنُ سَعِيدٍ، عَنِ ابْنِ جُرَيْجٍ، قَالَ أَخْبَرَنِي عَطَاءٌ، عَنْ جَابِرِ بْنِ عَبْدِ اللَّهِ، عَنِ النَّبِيِّ صلى الله عليه وسلم قَالَ ‏ "‏ مَنْ أَكَلَ مِنْ هَذِهِ الْبَقْلَةِ الثُّومِ - وَقَالَ مَرَّةً مَنْ أَكَلَ الْبَصَلَ وَالثُّومَ وَالْكُرَّاثَ - فَلاَ يَقْرَبَنَّ مَسْجِدَنَا فَإِنَّ الْمَلاَئِكَةَ تَتَأَذَّى مِمَّا يَتَأَذَّى مِنْهُ بَنُو آدَمَ ‏"‏ ‏.‏
Reference : Sahih Muslim 564c
In-book reference : Book 5, Hadith 92
USC-MSA web (English) reference : Book 4, Hadith 1147
  (deprecated numbering scheme)