كتاب الإمارة
33  
The Book on Government
(18)
Chapter: It is recommended for the army to swear allegiance to the ruler when intending to fight, and an account of Bay'at Ar-Ridwan beneath the tree
(18)
باب اسْتِحْبَابِ مُبَايَعَةِ الإِمَامِ الْجَيْشَ عِنْدَ إِرَادَةِ الْقِتَالِ وَبَيَانِ بَيْعَةِ الرِّضْوَانِ تَحْتَ الشَّجَرَةِ
Sahih Muslim 1856 c

It has been narrated on the authority of Abu Zubair who heard Jabir being questioned as to how many people were there on the Day of Hudaibiya. He replied:

We were fourteen hundred. We swore fealty to him, and Umar was holding his hand while he was sitting under the tree (to administer the oath). The tree was a samura (a wild tree found in deserts). All of as took the oath of fealty at his hands except Jadd b. Qais al-Ansari who hid himself under the belly of his camel.
وَحَدَّثَنَا مُحَمَّدُ بْنُ حَاتِمٍ، حَدَّثَنَا حَجَّاجٌ، عَنِ ابْنِ جُرَيْجٍ، أَخْبَرَنِي أَبُو الزُّبَيْرِ، سَمِعَ جَابِرًا، يُسْأَلُ كَمْ كَانُوا يَوْمَ الْحُدَيْبِيَةِ قَالَ كُنَّا أَرْبَعَ عَشْرَةَ مِائَةً فَبَايَعْنَاهُ وَعُمَرُ آخِذٌ بِيَدِهِ تَحْتَ الشَّجَرَةِ وَهِيَ سَمُرَةٌ فَبَايَعْنَاهُ غَيْرَ جَدِّ ابْنِ قَيْسٍ الأَنْصَارِيِّ اخْتَبَأَ تَحْتَ بَطْنِ بَعِيرِهِ.
Reference : Sahih Muslim 1856c
In-book reference : Book 33, Hadith 106
USC-MSA web (English) reference : Book 20, Hadith 4578
  (deprecated numbering scheme)