كتاب الإمارة
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 f

It has been narrated on the authority of Salim b. Abu al-Ja'd who said:

I asked Jabir b. 'Abdullah about the number of the Companions (of the Prophet who took the oath of fealty under) the tree. He said: If we were a hundred thousand, it (i. e. the water in the well at Hudaibiya) would have sufficed us, but actually we were one thousand and five hundred.
وَحَدَّثَنَا مُحَمَّدُ بْنُ الْمُثَنَّى، وَابْنُ، بَشَّارٍ قَالاَ حَدَّثَنَا مُحَمَّدُ بْنُ جَعْفَرٍ، حَدَّثَنَا شُعْبَةُ، عَنْ عَمْرِو بْنِ مُرَّةَ، عَنْ سَالِمِ بْنِ أَبِي الْجَعْدِ، قَالَ سَأَلْتُ جَابِرَ بْنَ عَبْدِ اللَّهِ عَنْ أَصْحَابِ، الشَّجَرَةِ فَقَالَ لَوْ كُنَّا مِائَةَ أَلْفٍ لَكَفَانَا كُنَّا أَلْفًا وَخَمْسَمِائَةٍ ‏.‏
Reference : Sahih Muslim 1856f
In-book reference : Book 33, Hadith 109
USC-MSA web (English) reference : Book 20, Hadith 4581
  (deprecated numbering scheme)