Salama reported,

I pledged allegiance to the Prophet ﷺ, then I moved aside to the shade of the tree. When the crowd thinned, he said, "Ibn al-Akwa, will you not pledge allegiance?"I said, "I have already pledged, Messenger of Allah."He said, "Do so again."So I pledged allegiance to him a second time.I asked him, "Abu Muslim, on what were you pledging that day?"He replied, "On death."

Bukhari 2960

Sahih

حدثنا المكي بن إبراهيم حدثنا يزيد بن أبي عبيد

عن سلمة رضي الله عنه قال

بايعت النبي ﷺ ثم عدلت إلى ظل الشجرة فلما خف الناس قال يا ابن الأكوع ألا تبايع قال قلت قد بايعت يا رسول الله قال وأيضا فبايعته الثانية فقلت له يا أبا مسلم على أي شيء كنتم تبايعون يومئذ قال على الموت

البخاري 2960صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Jihad and expeditions
Chapter
Pledge during war not to flee
Numbering
Darussalam 2960
Bukhari 2960