Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
bukhari:1194Musaddad > Yaḥyá > ʿUbaydullāh > Nāfiʿ > Ibn ʿUmar

The Prophet ﷺ used to go to the Mosque of Quba (sometimes) walking and sometimes riding.

Added Nafiʿ (in another narration), "He then would offer two rakʿat (in the Mosque of Quba)."  

البخاري:١١٩٤حَدَّثَنَا مُسَدَّدٌ حَدَّثَنَا يَحْيَى عَنْ عُبَيْدِ اللَّهِ قَالَ حَدَّثَنِي نَافِعٌ عَنِ ابْنِ عُمَرَ ؓ قَالَ

كَانَ النَّبِيُّ ﷺ يَأْتِي قُبَاءً رَاكِبًا وَمَاشِيًا

زَادَ ابْنُ نُمَيْرٍ حَدَّثَنَا عُبَيْدُ اللَّهِ عَنْ نَافِعٍ فَيُصَلِّي فِيهِ رَكْعَتَيْنِ