Language:
كتاب الجهاد والسير
56  
Fighting for the Cause of Allah (Jihaad)
(110)
Chapter: To give a Bai'a for not to flee during a battle
(110)
باب الْبَيْعَةِ فِي الْحَرْبِ أَنْ لاَ يَفِرُّوا
Sahih al-Bukhari 2960

Narrated Yazid bin Ubaid:

Salama said, "I gave the Pledge of allegiance (Al-Ridwan) to Allah's Messenger (ﷺ) and then I moved to the shade of a tree. When the number of people around the Prophet (ﷺ) diminished, he said, 'O Ibn Al-Akwa` ! Will you not give to me the pledge of Allegiance?' I replied, 'O Allah's Messenger (ﷺ)! I have already given to you the pledge of Allegiance.' He said, 'Do it again.' So I gave the pledge of allegiance for the second time." I asked 'O Abu Muslim! For what did you give he pledge of Allegiance on that day?" He replied, "We gave the pledge of Allegiance for death."

حَدَّثَنَا الْمَكِّيُّ بْنُ إِبْرَاهِيمَ، حَدَّثَنَا يَزِيدُ بْنُ أَبِي عُبَيْدٍ، عَنْ سَلَمَةَ ـ رضى الله عنه ـ قَالَ بَايَعْتُ النَّبِيَّ صلى الله عليه وسلم ثُمَّ عَدَلْتُ إِلَى ظِلِّ الشَّجَرَةِ، فَلَمَّا خَفَّ النَّاسُ قَالَ ‏"‏ يَا ابْنَ الأَكْوَعِ، أَلاَ تُبَايِعُ ‏"‏‏.‏ قَالَ قُلْتُ قَدْ بَايَعْتُ يَا رَسُولَ اللَّهِ‏.‏ قَالَ ‏"‏ وَأَيْضًا ‏"‏‏.‏ فَبَايَعْتُهُ الثَّانِيَةَ،‏.‏ فَقُلْتُ لَهُ يَا أَبَا مُسْلِمٍ، عَلَى أَىِّ شَىْءٍ كُنْتُمْ تُبَايِعُونَ يَوْمَئِذٍ قَالَ عَلَى الْمَوْتِ‏.‏
Reference : Sahih al-Bukhari 2960
In-book reference : Book 56, Hadith 171
USC-MSA web (English) reference : Vol. 4, Book 52, Hadith 207
  (deprecated numbering scheme)