(16) باب إِذَا نَذَرَ فِي الْجَاهِلِيَّةِ أَنْ يَعْتَكِفَ ثُمَّ أَسْلَمَ
Narrated Ibn `Umar:
that `Umar had vowed in the Pre-Islamic period to perform I`tikaf in Al-Masjid-al-Haram. (A subnarrator thinks that `Umar vowed to perform I`tikaf for one night.) Allah's Messenger (ﷺ) said to `Umar, "Fulfill your vow."
Reference: Sahih al-Bukhari 2043
In-book reference: Book 33, Hadith 18
USC-MSA web (English) reference(deprecated numbering scheme): Vol. 3, Book 33, Hadith 259