It was narrated that Ibn `Abbas said: `Umar (رضي الله عنه) said: I was marching with a group of people on a campaign with the Messenger of Allah (ﷺ), and I swore, saying: No, by my father. A man behind me called out: “Do not swear by your fathers.` I turned around and saw it was the Messenger of Allah (ﷺ).
Source: sunnah.com
Other translations
Arabic
حَدَّثَنَا حُسَيْنُ بْنُ مُحَمَّدٍ، حَدَّثَنَا إِسْرَائِيلُ، عَنْ سِمَاكٍ، عَنْ عِكْرِمَةَ، عَنِ ابْنِ عَبَّاسٍ، قَالَ قَالَ عُمَرُ رَضِيَ اللَّهُ عَنْهُ كُنْتُ فِي رَكْبٍ أَسِيرُ فِي غَزَاةٍ مَعَ رَسُولِ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ فَحَلَفْتُ فَقُلْتُ لَا وَأَبِي فَهَتَفَ بِي رَجُلٌ مِنْ خَلْفِي لَا تَحْلِفُوا بِآبَائِكُمْ فَالْتَفَتُّ فَإِذَا هُوَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ.
sunnah.com