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

It has been narrated on the authority of 'Abdullah b. Abu Aufa who said:

The Companions of the Tree (i e. those who swore fealty under the tree) were one thousand and three hundred, and the people of Aslam tribe were one-eighth of the Muhajirs.
حَدَّثَنَا عُبَيْدُ اللَّهِ بْنُ مُعَاذٍ، حَدَّثَنَا أَبِي، حَدَّثَنَا شُعْبَةُ، عَنْ عَمْرٍو، - يَعْنِي ابْنَ مُرَّةَ - حَدَّثَنِي عَبْدُ اللَّهِ بْنُ أَبِي أَوْفَى، قَالَ كَانَ أَصْحَابُ الشَّجَرَةِ أَلْفًا وَثَلاَثَمِائَةٍ وَكَانَتْ أَسْلَمُ ثُمُنَ الْمُهَاجِرِينَ ‏.‏
Reference : Sahih Muslim 1857a
In-book reference : Book 33, Hadith 112
USC-MSA web (English) reference : Book 20, Hadith 4584
  (deprecated numbering scheme)