The Messenger of Allah ﷺ shaved his head during the Farewell Pilgrimage.
إن رسول الله ﷺ حلق رأسه في حجة الوداع.
Bukhari narrated it in the Book of Military Campaigns (4410) via Abu Damra, and Muslim in the Book of Hajj (1304) via Yaqub bin Abdul-Rahman Qari and Hatim bin Ismail, all of them from Musa bin Uqba, from Nafi, from Ibn Umar, and he related it. Ibn Khuzayma narrated it (2930) via Ibn Jurayj, who said, Musa bin Uqba informed me, with his chain of transmission, and he added in it, "They claimed that the one who shaved the Prophet's ﷺ head was Mamar bin Abdullah bin Nadla bin Awf bin Ubayd bin Uwayj bin Adi bin Kaab."Hafiz said in Fath al-Bari (3/562), "Abu Masud clarified in Atraf that the one who said, 'They claimed,' was Ibn Jurayj, the one who narrated it from Musa bin Uqba."Nawawi claimed in his commentary on Muslim, and Diya Maqdisi in Sunan wal-Ahkam (4/228), and Hafiz in Fath al-Bari (1/274), that Bukhari "added, 'They claimed that the one who shaved the Prophet's ﷺ head was Mamar bin Abdullah.'"However, I have not come across this addition in the narration of Musa bin Uqba, nor did Nawawi mention it in his own copy, nor is it found in the narration of anyone else. So Allah knows best whether this addition was present in the copy they had.