Producing isn't actually enough, let's talk about the full cycle.
Even if you produce it cleanly, you'll need to store it + production of the turbins ...
And battery production (and mining for materials) pollutes the environment as well.
So let's not compare only parts of the system ... let's be real here
Most of these things are one time investments (plus maintenance), which you need for non-renewable energies just as well (and one might argue that building oil rigs and refineries and transporting the fuel is more CO2 intensive than windmills and power cables).