Sahih al-Bukhari, Volume 3, Book 49, Hadith 862 (USC-MSA)

Narrated Al-Bara bin `Azib: When Allah's Messenger concluded a peace treaty with the people of Hudaibiya, `Ali bin Abu Talib wrote the document and he mentioned in it, "Muhammad, Allah's Messenger." The pagans said, "Don't write: 'Muhammad, Allah's Messenger', for if you were an apostle we would not fight with you." Allah's Apostle asked `Ali to rub it out, but `Ali said, "I will not be the person to rub it out." Allah's Messenger rubbed it out and made peace with them on the condition that the Prophet and his companions would enter Mecca and stay there for three days, and that they would enter with their weapons in cases.

حَدَّثَنَا مُحَمَّدُ بْنُ بَشَّارٍ، حَدَّثَنَا غُنْدَرٌ، حَدَّثَنَا شُعْبَةُ، عَنْ أَبِي إِسْحَاقَ، قَالَ سَمِعْتُ الْبَرَاءَ بْنَ عَازِبٍ ـ رضى الله عنهما ـ قَالَ لَمَّا صَالَحَ رَسُولُ اللَّهِ صلى الله عليه وسلم أَهْلَ الْحُدَيْبِيَةِ كَتَبَ عَلِيٌّ بَيْنَهُمْ كِتَابًا فَكَتَبَ مُحَمَّدٌ رَسُولُ اللَّهِ صلى الله عليه وسلم‏.‏ فَقَالَ الْمُشْرِكُونَ لاَ تَكْتُبْ مُحَمَّدٌ رَسُولُ اللَّهِ، لَوْ كُنْتَ رَسُولاً لَمْ نُقَاتِلْكَ‏.‏ فَقَالَ لِعَلِيٍّ ‏ "‏ امْحُهُ ‏" ‏‏.‏ فَقَالَ عَلِيٌّ مَا أَنَا بِالَّذِي أَمْحَاهُ‏.‏ فَمَحَاهُ رَسُولُ اللَّهِ صلى الله عليه وسلم بِيَدِهِ، وَصَالَحَهُمْ عَلَى أَنْ يَدْخُلَ هُوَ وَأَصْحَابُهُ ثَلاَثَةَ أَيَّامٍ، وَلاَ يَدْخُلُوهَا إِلاَّ بِجُلُبَّانِ السِّلاَحِ، فَسَأَلُوهُ مَا جُلُبَّانُ السِّلاَحِ فَقَالَ الْقِرَابُ بِمَا فِيهِ‏.‏

sunnah.com