Receptor-interacting protein kinase 1 (RIPK1) and 3 (RIPK3) are critical regulators of programmed necrosis or necroptosis. However, the role of the RIPK1/RIPK3 signaling pathway in myocardial fibrosis and related diabetic cardiomyopathy is still unclear. We hypothesized that RIPK1/RIPK3 activation mediated myocardial fibrosis by impairing the autophagic flux. To this end, we established in vitro and in vivo models of type 2 diabetes mellitus with high glucose fat (HGF) medium and diet respectively. HGF induced myocardial fibrosis, and impaired cardiac diastolic and systolic function by activating the RIPK1/RIPK3 pathway, which increased the expression of autophagic related proteins such as LC3-II, P62 and active-cathepsin D. Inhibition of RIPK1 or RIPK3 alleviated HGF-induced death and fibrosis of cardiac fibroblasts by restoring the impaired autophagic flux. The autophagy blocker neutralized the effects of the RIPK1 inhibitor necrostatin-1 (Nec-1) and RIPK3 inhibitor GSK872 (GSK). RIPK1/RIPK3 inhibition respectively decreased the levels of RIPK3/p-RIPK3 and RIPK1/p-RIPK1. P62 forms a complex with RIPK1-RIPK3 and promotes the binding of RIPK1 and RIPK3, silencing of RIPK1 decreased the association of RIPK1 with P62 and the binding of P62 to LC3. Furthermore, inhibition of both kinases in combination with a low dose of Nec-1 and GSK in the HGF-treated fibroblasts significantly decreased cell death and fibrosis, and restored the autophagic flux. In the diabetic rat model, Nec-1 (1.65 mg/kg) treatment for 4 months markedly alleviated myocardial fibrosis, downregulated autophagic related proteins, and improved cardiac systolic and diastolic function. In conclusion, HGF induces myocardial fibrosis and cardiac dysfunction by activating the RIPK1-RIPK3 pathway and by impairing the autophagic flux, which is obviated by the pharmacological and genetic inhibition of RIPK1/RIPK3.