Sahih al-Bukhari, Book 30, Hadith 55 (In-Book) ⓘ
Narrated Tawus: Ibn `Abbas said, "Allah's Messenger set out from Medina to Mecca and he fasted till he reached 'Usfan, where he asked for water and raised his hand to let the people see him, and then broke the fast, and did not fast after that till he reached Mecca, and that happened in Ramadan." Ibn `Abbas used to say, "Allah's Messenger (sometimes) fasted and (sometimes) did not fast during the journeys so whoever wished to fast could fast, and whoever wished not to fast, could do so."
حَدَّثَنَا مُوسَى بْنُ إِسْمَاعِيلَ، حَدَّثَنَا أَبُو عَوَانَةَ، عَنْ مَنْصُورٍ، عَنْ مُجَاهِدٍ، عَنْ طَاوُسٍ، عَنِ ابْنِ عَبَّاسٍ ـ رضى الله عنهما ـ قَالَ خَرَجَ رَسُولُ اللَّهِ صلى الله عليه وسلم مِنَ الْمَدِينَةِ إِلَى مَكَّةَ، فَصَامَ حَتَّى بَلَغَ عُسْفَانَ، ثُمَّ دَعَا بِمَاءٍ فَرَفَعَهُ إِلَى يَدَيْهِ لِيُرِيَهُ النَّاسَ فَأَفْطَرَ، حَتَّى قَدِمَ مَكَّةَ، وَذَلِكَ فِي رَمَضَانَ فَكَانَ ابْنُ عَبَّاسٍ يَقُولُ قَدْ صَامَ رَسُولُ اللَّهِ صلى الله عليه وسلم وَأَفْطَرَ، فَمَنْ شَاءَ صَامَ، وَمَنْ شَاءَ أَفْطَرَ.
also referenced under: Hadith 1948 (DarusSalam) & Volume 3, Book 31, Hadith 169 (USC-MSA)