Sahih Muslim 1783 c
It has been narrated on the authority of Bara' who said:
When the Prophet (ﷺ) was checked from going to the Ka'ba, the people of Mecca made peace with him'on the condition that he would (be allowed to) enter Mecca (next year) and stay there for three days, that he would not enter (the city) except with swords in their sheaths and arms encased in their covers, that he would not take eway with him anyone from its dwellers, nor would he prevent anyone from those with him to stay on in Mecca (if he so desired). He said to 'Ali: Write down the terms settled between us. (So 'Ali wrote): In the name of Allah, most Gracious and most Merciful. This is what Muhammad, the Messenger of Allah, has settled (with the Meccans), The polytheists said to him: If we knew that thou art the Messenger of of Allah, we would follow you. But write: Muhammad b. 'Abdullah. So he told 'Ali to strike out these words. 'Ali said: No, by Allah, I will not strike them out. The Messenger of Allah (may Peace be upon him) said: Show me their place (on the parchment). So he ('Ali) showed him their place and he (the Holy Prophet) struck them out; and 'Ali wrote: Ibn 'Abdullah. (According to the terms of the treaty, next year) the Prophet (ﷺ) stayed there for three days When it was the third day, they said to 'Ali: This is the last day according to the terms of your companion. So tell him to leave. 'Ali informed the Prophet (ﷺ) accordingly. He said: Yes, and left (the city). Ibn Janab in his version of the tradition used:" we would swear allegiance to you" instead of" we would follow you".
حَدَّثَنَا إِسْحَاقُ بْنُ إِبْرَاهِيمَ الْحَنْظَلِيُّ، وَأَحْمَدُ بْنُ جَنَابٍ الْمِصِّيصِيُّ، جَمِيعًا عَنْ عِيسَى بْنِ يُونُسَ، - وَاللَّفْظُ لإِسْحَاقَ - أَخْبَرَنَا عِيسَى بْنُ يُونُسَ، أَخْبَرَنَا زَكَرِيَّاءُ، عَنْ أَبِي إِسْحَاقَ، عَنِ الْبَرَاءِ، قَالَ لَمَّا أُحْصِرَ النَّبِيُّ صلى الله عليه وسلم عِنْدَ الْبَيْتِ صَالَحَهُ أَهْلُ مَكَّةَ عَلَى أَنْ يَدْخُلَهَا فَيُقِيمَ بِهَا ثَلاَثًا وَلاَ يَدْخُلَهَا إِلاَّ بِجُلُبَّانِ السِّلاَحِ السَّيْفِ وَقِرَابِهِ ‏.‏ وَلاَ يَخْرُجَ بِأَحَدٍ مَعَهُ مِنْ أَهْلِهَا وَلاَ يَمْنَعَ أَحَدًا يَمْكُثُ بِهَا مِمَّنْ كَانَ مَعَهُ ‏.‏ قَالَ لِعَلِيٍّ ‏"‏ اكْتُبِ الشَّرْطَ بَيْنَنَا بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيمِ هَذَا مَا قَاضَى عَلَيْهِ مُحَمَّدٌ رَسُولُ اللَّهِ ‏"‏ ‏.‏ فَقَالَ لَهُ الْمُشْرِكُونَ لَوْ نَعْلَمُ أَنَّكَ رَسُولُ اللَّهِ تَابَعْنَاكَ وَلَكِنِ اكْتُبْ مُحَمَّدُ بْنُ عَبْدِ اللَّهِ ‏.‏ فَأَمَرَ عَلِيًّا أَنْ يَمْحَاهَا فَقَالَ عَلِيٌّ لاَ وَاللَّهِ لاَ أَمْحَاهَا ‏.‏ فَقَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ أَرِنِي مَكَانَهَا ‏"‏ ‏.‏ فَأَرَاهُ مَكَانَهَا فَمَحَاهَا وَكَتَبَ ‏"‏ ابْنُ عَبْدِ اللَّهِ ‏"‏ ‏.‏ فَأَقَامَ بِهَا ثَلاَثَةَ أَيَّامٍ فَلَمَّا أَنْ كَانَ يَوْمُ الثَّالِثِ قَالُوا لِعَلِيٍّ هَذَا آخِرُ يَوْمٍ مِنْ شَرْطِ صَاحِبِكَ فَأْمُرْهُ فَلْيَخْرُجْ ‏.‏ فَأَخْبَرَهُ بِذَلِكَ فَقَالَ ‏"‏ نَعَمْ ‏"‏ ‏.‏ فَخَرَجَ ‏.‏ وَقَالَ ابْنُ جَنَابٍ فِي رِوَايَتِهِ مَكَانَ تَابَعْنَاكَ بَايَعْنَاكَ ‏.‏