Jabir bin Abdullah reported,

The Messenger of Allah ﷺ said, "Whoever eats garlic or onions should keep away from us," or he said, "should keep away from our mosque, and remain in his house."A pot containing some green vegetables was once brought to him. He noticed an odor coming from it and asked about its contents. When he was informed of the vegetables it contained, he said, "Bring it close to one of his companions."When he saw that the Prophet disliked eating it, he too declined. The Prophet ﷺ said to him, "Eat, for I converse privately with one with whom you do not converse."

Azami 9551

Sahih

عن جابر بن عبد الله قال

أن رسول الله ﷺ قال: من أكل ثوما أو بصلا فليعتزلنا- أو ليعتزل مسجدنا- وليقعد في بيته وأنه أتي بقدر فيه خضرات من بقول، فوجد لها ريحا، فسأل فأخبر بما فيها من البقول، فقال: قربوها إلى بعض أصحابه، فلما رآه كره أكلها قال: كل، فإني أناجي من لا تناجي.

الأعظمي 9551صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Biography of the Prophet ﷺ
Chapter
Daily life of the Prophet ﷺ
Section
Dislike of the Prophet ﷺ eating garlic, onions, and vegetables
Numbering
Jami al-Kamil 9551 (2nd edition)
Azami 9551