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