Primary depositional and diagenetic processes exert very important influences on shale gas reservoirs. Rock electrical properties are an important basis for making reservoir prediction using the electromagnetic method (EM). However, there is still a lack of understanding about the impact of the sedimentary diagenesis process on shale electrical properties, this study focuses on the impact of diagenesis on rock properties. In this study, rock electrical properties are studied based on electromagnetic experiments. We systematically studied the lithofacies of different depositional paleoenvironments and diagenetic processes, and the influence of diagenetic evolution on the rock electrical properties was discussed, by means of X-ray diffraction (XRD) analysis, field-emission scanning electron microscopy (FE-SEM), low-temperature nitrogen adsorption (LTNA), and trace element (TE) geochemical analysis. Based on the study of mineral composition, grain assemblages and pore systems, we identified four lithofacies in the Longmaxi Formation: siliceous shale, siliceous-argillaceous mixed shale, silty shale and argillaceous shale. Redox proxies (U/Th, V/Cr, and Ni/Co) indicate that the siliceous shale was deposited in a relatively anoxic and reducing environment, indicating a deep-water shelf depositional paleoenvironment. The siliceous-argillaceous shale, silty shale and argillaceous shale were deposited under a relatively dysoxic-oxic environment, indicating a shallow-water shelf depositional paleoenvironment. The order of resistivity values of the lithofacies within the Longmaxi Formation is 36.78 Ω m (siliceous shale), 66.81 Ω m (siliceous-argillaceous mixed shale), 79.54 Ω m (silty shale), and 107.00 Ω m (argillaceous shale), and the resistivity decreases with an increase in porosity. The siliceous shale has the most abundant authigenic quartz, which filled the primary pores forming a rigid framework during the gas window, inhibited compaction, increased the distribution of organic matter (OM), and enhanced the development of OM pores. The high TOC content and high maturity of siliceous shale at the bottom of Longmaxi Formation make the OM pores more developed. Pyrite, conductive fluid and pore network under the main control of OM pores in shale form a conductive circuit when AC voltage is input, which increases the exchange capacity of cations and leads to the phenomenon of low resistivity. The interconnected OM pore network, both depositionally and diagenetically derived, affects the electrical properties of the Longmaxi shale. This study reveals that electrical properties of shale rocks and its variations can be impacted by the depositional environment and diagenetic processes. This work provides resistivity parameters for the electromagnetic exploration of shale gas under complex terrain conditions and provides a theoretical basis for later interpretation.