Language:
كتاب المغازى
64  
Military Expeditions led by the Prophet (pbuh) (Al-Maghaazi)
(48)
Chapter: Where did the Prophet (saws) fix the flag on the day of the conquest of Makkah?
(48)
باب أَيْنَ رَكَزَ النَّبِيُّ صلى الله عليه وسلم الرَّايَةَ يَوْمَ الْفَتْحِ
Sahih al-Bukhari 4286

Narrated Anas bin Malik:

On the day of the Conquest, the Prophet (ﷺ) entered Mecca, wearing a helmet on his head. When he took it off, a man came and said, "Ibn Khatal is clinging to the curtain of the Ka`ba." The Prophet (ﷺ) said, "Kill him." (Malik a sub-narrator said, "On that day the Prophet (ﷺ) was not in a state of Ihram as it appeared to us, and Allah knows better.")

حَدَّثَنَا يَحْيَى بْنُ قَزَعَةَ، حَدَّثَنَا مَالِكٌ، عَنِ ابْنِ شِهَابٍ، عَنْ أَنَسِ بْنِ مَالِكٍ ـ رضى الله عنه ـ أَنَّ النَّبِيَّ صلى الله عليه وسلم دَخَلَ مَكَّةَ يَوْمَ الْفَتْحِ وَعَلَى رَأْسِهِ الْمِغْفَرُ، فَلَمَّا نَزَعَهُ جَاءَ رَجُلٌ فَقَالَ ابْنُ خَطَلٍ مُتَعَلِّقٌ بِأَسْتَارِ الْكَعْبَةِ‏.‏ فَقَالَ ‏ "‏ اقْتُلْهُ ‏"‏ قَالَ مَالِكٌ وَلَمْ يَكُنِ النَّبِيُّ صلى الله عليه وسلم فِيمَا نُرَى وَاللَّهُ أَعْلَمُ يَوْمَئِذٍ مُحْرِمًا‏.‏
Reference : Sahih al-Bukhari 4286
In-book reference : Book 64, Hadith 319
USC-MSA web (English) reference : Vol. 5, Book 59, Hadith 582
  (deprecated numbering scheme)