Sayyiduna Ibn Abbas (may Allah be pleased with them both) narrated from the Messenger of Allah (peace and blessings be upon him), he (peace and blessings be upon him) said: "Whoever eats from these foul-smelling vegetables (such as garlic, onion, and radish, etc.), then he should not come near our mosques, because that which causes discomfort to humans also causes discomfort to the angels."
Hadith Referenceمسند اسحاق بن راهويه / كتاب الصلوٰة / 209
Hadith Takhrij«بخاري ، كتاب الاذان ، باب ماجاء فى الثوم البصل الكراث ، رقم : 853 . مسلم ، كتاب المساجد ، باب نهي من اكل ثوم او بصل الخ : 562 . سنن ابوداود ، رقم : 3822 . سنن ترمذي ، رقم : 1806 . سنن نسائي ، رقم : 707 . سنن ابن ماجه ، رقم : 1016 . مسند احمد : 374/3 .»
Sayyiduna Jabir (may Allah be pleased with him) said: Garlic was not found in our area, rather there was onion and gindana (a type of vegetable), so we were prohibited from it.
Hadith Referenceمسند اسحاق بن راهويه / كتاب الصلوٰة / 210
Hadith Takhrij«مسند احمد : 374/3 . قال شعيب الارناوط : اسناده صحيح .»