Come to the masjid smelling clean

Whoever has eaten raw garlic or onion should keep away from the masjid.

Narrated by Jabir ibn Abdullah

Whoever eats garlic or onion, let him keep away from us, or keep away from our masjid, and let him stay in his house.

Sahih al-Bukhari 855, Sahih Muslim 564

What this hadith teaches

Bad smells hurt the worshippers and the angels. The same applies to smoking, dirty socks or anything that bothers people in the rows.

Reference and grade

Grade
Sahih: agreed upon by al-Bukhari and Muslim
Narrator
Jabir ibn Abdullah
Chapter
The masjid

The hadith in Arabic نص الحديث

مَنْ أَكَلَ ثُومًا أَوْ بَصَلاً فَلْيَعْتَزِلْنَا ـ أَوْ قَالَ ـ فَلْيَعْتَزِلْ مَسْجِدَنَا، وَلْيَقْعُدْ فِي بَيْتِهِ ‏"‏‏.‏ وَأَنَّ النَّبِيَّ صلى الله عليه وسلم أُتِيَ بِقِدْرٍ فِيهِ خَضِرَاتٌ مِنْ بُقُولٍ، فَوَجَدَ لَهَا رِيحًا فَسَأَلَ فَأُخْبِرَ بِمَا فِيهَا مِنَ الْبُقُولِ فَقَالَ ‏"‏ قَرِّبُوهَا ‏"‏ إِلَى بَعْضِ أَصْحَابِهِ كَانَ مَعَهُ، فَلَمَّا رَآهُ كَرِهَ أَكْلَهَا قَالَ ‏"‏ كُلْ فَإِنِّي أُنَاجِي مَنْ لاَ تُنَاجِي

Arabic text of Sahih al-Bukhari 855, as given on sunnah.com.