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:2958Mūsá b. Ismāʿīl > Jūwayriyah > Nāfiʿ > Ibn ʿUmar Rajaʿnā from al-ʿĀm al-Muqbil Famā Ājtamaʿ Minnā Āthnān > al-Shajarah al--Atī Bāyaʿnā Taḥtahā Kānat Raḥmah from Allāh Fasaʾalt Nāfiʿ > a Shaʾ Bāyaʿahum > al-Mawt

When we reached (Hudaibiya) in the next year (of the treaty of Hudaibiya), not even two men amongst us agreed unanimously as to which was the tree under which we had given the pledge of allegiance, and that was out of Allah's Mercy. (The sub narrator asked Naf'i, "For what did the Prophet ﷺ take their pledge of allegiance, was it for death?" Naf'i replied "No, but he took their pledge of allegiance for patience.")  

البخاري:٢٩٥٨حَدَّثَنَا مُوسَى بْنُ إِسْمَاعِيلَ حَدَّثَنَا جُوَيْرِيَةُ عَنْ نَافِعٍ قَالَ قَالَ ابْنُ عُمَرَ ؓ رَجَعْنَا مِنَ الْعَامِ الْمُقْبِلِ فَمَا اجْتَمَعَ مِنَّا اثْنَانِ عَلَى الشَّجَرَةِ الَّتِي بَايَعْنَا تَحْتَهَا كَانَتْ رَحْمَةً مِنَ اللَّهِ فَسَأَلْتُ نَافِعًا عَلَى أَىِّ شَىْءٍ بَايَعَهُمْ عَلَى الْمَوْتِ قَالَ

لاَ بَايَعَهُمْ عَلَى الصَّبْرِ  


See similar narrations below:

Collected by Bayhaqī
bayhaqi:21446Abū ʿAbdullāh > Abū al-ʿAbbās > Yaḥyá > Yazīd > Ḥammād b. Zayd > Abū Hāshim > Ibn Masʿūd

[Machine] Loyalty is not for sale.  

البيهقي:٢١٤٤٦أَخْبَرَنَا أَبُو عَبْدِ اللهِ ثنا أَبُو الْعَبَّاسِ ثنا يَحْيَى أنبأ يَزِيدُ أنبأ حَمَّادُ بْنُ زَيْدٍ عَنْ أَبِي هَاشِمٍ أَنَّ ابْنَ مَسْعُودٍ ؓ قَالَ

لَا يُبَاعُ الْوَلَاءُ