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

It has been narrated on the authority of Sa'id b. Musayyab who said:

My father was one of those who swore fealty to the Messenger of Allah (ﷺ) near the tree. When we passed that way next year intending to perform the Hajj, the place of the tree was hidden to us. If you could point out clearly, you would (certainly) be knowing better. It has also been narrated on the authority of Sa'id b. Musayyib who learnt from his father that they were with the Messenger of Allah (ﷺ) in the year of the Tree (i. e. in the year of the fealty of God's pleasure sworn under the tree at Hudaibiya), but next year they forgot the spot of the tree.
وَحَدَّثَنَاهُ حَامِدُ بْنُ عُمَرَ، حَدَّثَنَا أَبُو عَوَانَةَ، عَنْ طَارِقٍ، عَنْ سَعِيدِ بْنِ الْمُسَيَّبِ، قَالَ كَانَ أَبِي مِمَّنْ بَايَعَ رَسُولَ اللَّهِ صلى الله عليه وسلم عِنْدَ الشَّجَرَةِ ‏.‏ قَالَ فَانْطَلَقْنَا فِي قَابِلٍ حَاجِّينَ فَخَفِيَ عَلَيْنَا مَكَانُهَا فَإِنْ كَانَتْ تَبَيَّنَتْ لَكُمْ فَأَنْتُمْ أَعْلَمُ ‏.‏ وَحَدَّثَنِيهِ مُحَمَّدُ بْنُ رَافِعٍ، حَدَّثَنَا أَبُو أَحْمَدَ، قَالَ وَقَرَأْتُهُ عَلَى نَصْرِ بْنِ عَلِيٍّ عَنْ أَبِي أَحْمَدَ، حَدَّثَنَا سُفْيَانُ، عَنْ طَارِقِ بْنِ عَبْدِ الرَّحْمَنِ، عَنْ سَعِيدِ بْنِ الْمُسَيَّبِ، عَنْ أَبِيهِ، أَنَّهُمْ كَانُوا عِنْدَ رَسُولِ اللَّهِ صلى الله عليه وسلم عَامَ الشَّجَرَةِ قَالَ فَنَسُوهَا مِنَ الْعَامِ الْمُقْبِلِ.
Reference : Sahih Muslim 1859a, b
In-book reference : Book 33, Hadith 116
USC-MSA web (English) reference : Book 20, Hadith 4588
  (deprecated numbering scheme)