Abdullah bin Abbas reported,

Ibn Abbas and Hurr bin Qays bin Hisn al-Fazari disputed about the companion of Musa, whether he was Khidr. Ubayy bin Kaab al-Ansari passed by them, so Ibn Abbas called him over and said, "I have been disputing with this companion of mine about the companion of Musa, the one whom Musa sought a way to meet. Did you hear the Messenger of Allah ﷺ mention his story?"Ubayy replied, "Yes. I heard the Messenger of Allah ﷺ say, 'While Musa was sitting among a gathering of the Children of Israil, a man came to him and asked, "Do you know anyone more knowledgeable than yourself?" Musa answered, "No." So it was revealed to Musa, "Yes, Our servant Khidr is more knowledgeable." Musa then sought a way to meet him, and Allah made the fish a sign for him. He was told, "When you lose the fish, turn back, for you will meet him there." So Musa began following the trail of the fish in the sea.Then Musa's young companion said to him, "Do you remember when we took refuge at the rock? Indeed, I forgot the fish, and none made me forget to mention it except Satan" [Kahf 18:63].Musa said, "That is what we were seeking. So they returned, retracing their footsteps" [Kahf 18:64].They found Khidr, and what happened between them was as Allah has recounted.'"

Bukhari 7478

Sahih

حدثنا عبد الله بن محمد حدثنا أبو حفص عمرو حدثنا الأوزاعي حدثني ابن شهاب عن عبيد الله بن عبد الله بن عتبة بن مسعود

عن ابن عباس رضي الله عنهما

أنه تمارى هو والحر بن قيس بن حصن الفزاري في صاحب موسى أهو خضر فمر بهما أبي بن كعب الأنصاري فدعاه ابن عباس فقال إني تماريت أنا وصاحبي هذا في صاحب موسى الذي سأل السبيل إلى لقيه هل سمعت رسول الله ﷺ يذكر شأنه قال نعم إني سمعت رسول الله ﷺ يقول بينا موسى في ملإ من بني إسرائيل إذ جاءه رجل فقال هل تعلم أحدا أعلم منك فقال موسى لا فأوحي إلى موسى بلى عبدنا خضر فسأل موسى السبيل إلى لقيه فجعل الله له الحوت آية وقيل له إذا فقدت الحوت فارجع فإنك ستلقاه فكان موسى يتبع أثر الحوت في البحر فقال فتى موسى لموسى {أرأيت إذ أوينا إلى الصخرة فإني نسيت الحوت وما أنسانيه إلا الشيطان أن أذكره} قال موسى {ذلك ما كنا نبغي فارتدا على آثارهما قصصا} فوجدا خضرا وكان من شأنهما ما قص الله

البخاري 7478صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Tawhid
Chapter
Will and volition
Numbering
Darussalam 7478
Bukhari 7478