Sahih al-Bukhari, Book 33, Hadith 18 (Bukhari 1969)

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."