It does matter because for now renewables are manufactured mostly with coal and oil
EDIT: I'm not a renewable skeptic, answers bellow
This doesn’t matter that much. Solar and batteries will last for decades with minimal maintenance and no input.
Any kind of fossil fuel generation means constantly going out and digging up new oil sources, shipping them around the world, and then burning them. So you invest a lot of time & money into something that disappears immediately and also heats up the environment.
Meanwhile, a solar panel just sits there for decades passively making energy with very few externalities.
Not to mention, recycling solar panels & batteries is getting cheaper & more effective by the day. The metal (and even oil!) you dug out of the ground to build them didn’t get burned up; a lot of it is still usable.
They're manufactured once and then generate way more energy than was used to make them.
Which is a tiny CO2 spend compared to the benefit, unless you dishonestly factor in manufacturing energy costs as coming from oil.
All of the cradle-to-grave studies I've seen about greenhouse gas emissions for renewables versus coal/oil still indicate massive improvements.
This government meta study of 3,000 such studies puts PV solar at roughly 20x less emissions than coal.
https://docs.nrel.gov/docs/fy21osti/80580.pdf