AHMAD 15299:
from ʿAlī b. ʿAbdullāh —
The Prophet ﷺ said, "Whoever eats garlic or onion should keep away from our mosque or should remain in his house." (Jabir bin ʿAbdullah, in another narration said, "Once a big pot containing cooked vegetables was brought. On finding unpleasant smell coming from it, the Prophet ﷺ asked, 'What is in it?' He was told all the names of the vegetables that were in it. The Prophet ﷺ ordered that it should be brought near to some of his companions who were with him. When the Prophet ﷺ saw it he disliked to eat it and said, 'Eat. (I don't eat) for I converse with those whom you don't converse with (i.e. the angels). (Using translation from Bukhārī 855)
أحمد ١٥٢٩٩:
عن علي بن عبد الله —
أَنَّ رَسُولَ اللهِ ﷺ قَالَ مَنْ أَكَلَ ثُومًا أَوْ بَصَلًا فَلْيَعْتَزِلْنَا أَوْ قَالَ فَلْيَعْتَزِلْ مَسْجِدَنَا وَلْيَقْعُدْ فِي بَيْتِهِ
hadithunlocked.com