Nafi' narrates from Ibn Umar (may Allah be pleased with them both) that the Messenger of Allah (peace and blessings be upon him) said: "Whoever eats from this plant (meaning garlic) should not even come near our mosque until its smell has gone."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 5050
Abd al-Aziz bin Suhayb says: We asked Sayyiduna Anas bin Malik (may Allah be pleased with him): What did you hear from the Prophet (peace and blessings be upon him) about garlic? Sayyiduna Anas (may Allah be pleased with him) said: The Prophet (peace and blessings be upon him) said: "Whoever eats of this plant, let him neither come near our mosque nor pray with us."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 5051
(a) Sayyiduna Abu Hurayrah (may Allah be pleased with him) says that the Messenger of Allah (peace and blessings be upon him) said: "Whoever eats of this plant (meaning garlic), let him not trouble us in our mosques."
(b) In the narration of Muhammad bin Rafi': "Let him not come near our mosque, and let him not trouble us with the smell of garlic."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 5052
It is narrated from Jabir (may Allah be pleased with him) that he (peace and blessings be upon him) said: "Whoever eats garlic," then he said: "Whoever eats garlic, onions and leeks, let him not come near our mosque, for the angels are harmed by what harms human beings."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 5053
Sayyiduna Jabir bin Abdullah (may Allah be pleased with them both) says that the Prophet (peace and blessings be upon him) forbade eating onions and leeks, but when in need we would eat them. The Prophet (peace and blessings be upon him) said: "Whoever eats of this foul plant, let him not come near our mosque, for the angels too are harmed by what harms human beings."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 5054
Sayyiduna Hudhayfah (may Allah be pleased with him) narrates from the Prophet (peace and blessings be upon him) that he (peace and blessings be upon him) said: "Whoever spits in the direction of the qiblah, on the Day of Resurrection his spittle will be between his eyes; and whoever eats of this foul vegetable, let him not come near our mosque." He (peace and blessings be upon him) said it three times.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 5055
It is narrated from Sayyiduna Jabir bin Abdullah (may Allah be pleased with them both) that the Messenger of Allah (peace and blessings be upon him) said: "Whoever eats garlic or onion, let him keep away from us, or keep away from our mosque, or let him stay in his house." A pot containing vegetables was brought to him (peace and blessings be upon him), and he (peace and blessings be upon him) noticed its smell; he (peace and blessings be upon him) was told what vegetables were in it. He (peace and blessings be upon him) said: "Bring it near to my companions." When the man saw that he (peace and blessings be upon him) disliked it, he too held back. He (peace and blessings be upon him) said: "Eat, for I converse in private with those with whom you do not converse."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 5056