Purpose This paper aims to reveal the green governance role played by stock connect in transition economies from the perspective of corporates’ environmental violations and provides implications for the coordination and optimization of subsequent stock market liberalization and green transformation policies in pursuit of carbon peaking and carbon neutrality goals. Design/methodology/approach With the data of Chinese listed enterprises, this paper takes the Shanghai-Hong Kong Stock Connect or Shenzhen-Hong Kong Stock Connect in China as a quasi-natural experiment and applies the multi-period difference-in-difference (DID) model to identify the impact of stock market liberalization on the corporates’ environmental violations. Findings The findings reveal that the stock market liberalization significantly restrains the corporates’ environmental violations. These findings are robust to a series of sensitivity tests, including excluding two-way effects, adjusting the year of policy implementation, replacing the core variables, introducing the regional fixed effects and excluding the interference effect of other relevant policies during the sample period. Furthermore, the stock market liberalization is beneficial for upgrading information disclosure quality, improving internal governance capability, strengthening environmental protection incentives, and thus restrains corporates’ environmental violations. Meanwhile, heterogeneity tests show that the inhibitory effects are more significant in those grouped samples which is large scale, state-owned nature, located in eastern region, with poor evaluation performances and heavy tax burden. Originality/value We make two marginal contributions to the current literature. First, this paper enriches the literature on the factors influencing corporate environmental violations by focusing on how the macro-level financial policy influences the micro-level corporate environmental violations. One the one hand, prior studies mainly focused on the consequences of corporate environmental violations; however, there is still a puzzle that the effect of stock market liberalization cannot be fully justified to influence corporate environmental violations. The findings help explain this puzzle by examining that stock market liberalization can restrain corporate environmental violations. Moreover, prior studies mainly focused on corporate share price (Yunsen Chen et al., 2022), market liquidity (Han Kim and Singal, 2000), information disclosure (Liang, Lin, and Chin 2012), corporate governance (Bae and Goyal, 2010) and corporate violations (Lingyun Xiong et al., 2021), but not on corporate environmental violations. We assume that the suppression effect of stock market liberalization on corporate environmental violations can help reduce corporate environmental violations, improve corporates’ awareness of environmental compliance. Second, this paper contributes to a better understanding of the literature on stock market liberalization by investigating the restraining effect of Stock Connect on corporate environmental violations from the perspective of information channel, corporate governance channel and motivation channel, which is of practical significance. Moreover, we investigate the differences in the inhibitory effects of stock market liberalization on different enterprises' environmental violations, from firm size, property rights, enterprise assessment results, tax burden to geographical location, which is conducive to the construction of a green financial system and the promotion of sustainable economic development. Our results show that firms which are large scale, state-owned nature, located in eastern region, with poor evaluation performances and heavy tax burden tend to compliance with environmental laws. These findings emphasize the importance and benefits of Stock Connect.