Bara bin Azib reported,

This verse was revealed concerning us. Whenever the Ansar returned from performing Hajj, they would not enter through the front doors of their houses but through the back. One man from the Ansar came and entered through his front door, and he was reproached for it. Then this was revealed, "It is not righteousness that you enter the houses from their backs, but righteousness belongs to the one who is mindful of Allah. So enter the houses through their doors" [Baqarah 2:189].

Azami 11968

Sahih

عن البراء بن عازب يقول

نزلت هذه الآية فينا كانت الأنصار إذا حجوا فجاؤوا لم يدخلوا من قبل أبواب بيوتهم، ولكن من ظهورها، فجاء رجل من الأنصار فدخل من قبل بابه، فكأنه عير بذلك، فنزلت: {وليس البر بأن تأتوا البيوت من ظهورها ولكن البر من اتقى وأتوا البيوت من أبوبها}

الأعظمي 11968صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Tafsir of the great Quran
Chapter
Virtues of Surah Baqarah
Section
His saying, "They ask you about the crescent moons. Say, they are time markers for the people and for Hajj. And it is not righteousness that you enter houses from their backs, but righteousness is in one who fears Allah. And enter houses from their doors, and fear Allah that you may succeed."
Numbering
Jami al-Kamil 11968 (2nd edition)
Azami 11968