The Messenger of Allah ﷺ heard him swearing by his father, so the Messenger of Allah ﷺ said, "Allah forbids you to swear by your fathers."Umar said, "I have not sworn by it since, neither speaking on my own behalf nor reporting another's words."
حدثنا محمد بن أبي عمر العدني حدثنا سفيان بن عيينة عن الزهري عن سالم بن عبد الله بن عمر عن أبيه
أن رسول الله ﷺ سمعه يحلف بأبيه فقال رسول الله ﷺ إن الله ينهاكم أن تحلفوا بآبائكم قال عمر فما حلفت بها ذاكرا ولا آثرا
Bukhari narrated it in the Book of Oaths and Vows, chapter "Do Not Swear by Your Fathers," hadith no. 6647, from the hadith of Zuhri through this chain, and Muslim, in the Book of Oaths, chapter on the prohibition of swearing by other than Allah the Exalted, hadith no. 1646, from the hadith of Ibn Uyayna and others.