I heard `Umar saying, "Allah's Messenger (ﷺ) said to me, 'Allah forbids you to swear by your fathers." `Umar said, "By Allah! Since I heard that from the Prophet (ﷺ) , I have not taken such an oath, neither intentionally, nor by reporting the oath of someone else."
Sahih al-Bukhari Book 83, Hadith 26