Abu Huraira reported God’s Messenger as saying, "Do not swear by your fathers, or by your mothers, or by rivals (Cf. Al-Qur’an 2:22 etc. The reference is to idols or false gods) to God; and swear by God only when you are speaking the truth.”
‘A’isha said that the verse, "God will not take you to account for what is futile in your oaths” (Al-Qu’ran 2:225; 5:89) was sent down about such phrases as "No, by God,” and "Yes, by God.”
Bukhari transmitted it. Sharh as-sunna has the wording of al-Masabih, saying that some transmitters traced it back to the Prophet on ‘A’isha’s authority.