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

It has been narrated (through a different chain of transmitters) on the authority of Abu Zubair who heard Jabir being questioned as to whether the Prophet (ﷺ) took the oath of fealty at Dhu'l-Hulaifa. He said:

No! But he offered his prayers at that place, and he administered the oath of fealty nowhere except near the tree in (the plain oo Hudaibiya. Ibn Juraij said that he was informed by Abu Zabair who heard Jabir b. Abdullah say: The Prophet (ﷺ) prayed over the well at Hudaibiya (as a result of which its scanty water rose up and increased so as to be sufficient for the 1400 or 1500 men who had encamped at the place).
وَحَدَّثَنِي إِبْرَاهِيمُ بْنُ دِينَارٍ، حَدَّثَنَا حَجَّاجُ بْنُ مُحَمَّدٍ الأَعْوَرُ، مَوْلَى سُلَيْمَانَ بْنِ مُجَالِدٍ قَالَ قَالَ ابْنُ جُرَيْجٍ وَأَخْبَرَنِي أَبُو الزُّبَيْرِ، أَنَّهُ سَمِعَ جَابِرًا، يُسْأَلُ هَلْ بَايَعَ النَّبِيُّ صلى الله عليه وسلم بِذِي الْحُلَيْفَةِ فَقَالَ لاَ وَلَكِنْ صَلَّى بِهَا وَلَمْ يُبَايِعْ عِنْدَ شَجَرَةٍ إِلاَّ الشَّجَرَةَ الَّتِي بِالْحُدَيْبِيَةِ ‏.‏ قَالَ ابْنُ جُرَيْجٍ وَأَخْبَرَنِي أَبُو الزُّبَيْرِ أَنَّهُ سَمِعَ جَابِرَ بْنَ عَبْدِ اللَّهِ يَقُولُ دَعَا النَّبِيُّ صلى الله عليه وسلم عَلَى بِئْرِ الْحُدَيْبِيَةِ ‏.‏
Reference : Sahih Muslim 1856d
In-book reference : Book 33, Hadith 107
USC-MSA web (English) reference : Book 20, Hadith 4579
  (deprecated numbering scheme)