Ali bin Abu Talib reported,

The Messenger of Allah ﷺ said, "Whoever claims descent from someone other than his father, or attaches himself to people other than his own patrons, upon him is the curse of Allah, the angels, and all of humankind. Allah will accept from him no obligatory worship nor any voluntary deed on the Day of Resurrection."

Azami 578

Sahih

عن علي بن أبي طالب، قال

قال رسول الله ﷺ: من ادعى إلى غير أبيه، أو انتمى إلى غير مواليه فعليه لعنة الله والملائكة والناس أجمعين. لا يقبل الله منه يوم القيامة صرفا ولا عدلا.

الأعظمي 578صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Faith
Chapter
Belief in the angels
Section
Curse of the angels upon one who claims lineage to other than his father or allies with other than his masters
Numbering
Jami al-Kamil 578 (2nd edition)
Azami 578