Yahya related to me from Malik from Nafi from Abdullah ibn Umar that one time the Messenger of Allah ﷺ was speaking to Umar ibn al-Khattab while he was travelling with a troop and Umar swore by his father and he (the Messenger) said, "Allah forbids you to swear by your fathers. If anyone swears, let him swear by Allah or keep silent."
أَنَّ رَسُولَ اللَّهِ ﷺ أَدْرَكَ عُمَرَ بْنَ الْخَطَّابِ رضى الله عنه وَهُوَ يَسِيرُ فِي رَكْبٍ وَهُوَ يَحْلِفُ بِأَبِيهِ فَقَالَ رَسُولُ اللَّهِ ﷺ إِنَّ اللَّهَ يَنْهَاكُمْ أَنْ تَحْلِفُوا بِآبَائِكُمْ فَمَنْ كَانَ حَالِفًا فَلْيَحْلِفْ بِاللَّهِ أَوْ لِيَصْمُتْ