It is narrated from Sayyiduna Anas (may Allah be pleased with him) that he said: "The Messenger of Allah (peace and blessings be upon him) forbade eating garlic and onions."
It is narrated in the two Sahihs: "Whoever eats from this plant must not come near our mosque," meaning garlic.