Electricity generation and battery production are very far from clean and green technology.
Unlike the exploration, prospecting, drilling, extraction, transport, refinement, and distribution of fossil fuels which have never produced any pollution and long-term environmental damage whatsoever.
Battery technology is advancing faster than anyone could have imagined even a few years ago. The LiFePO4 batteries on my solar array contain no nasty cobalt and can’t overheat or catch fire. They can be charged at 3.5KW, be discharged down to 10%, have no cycle limit and are guaranteed for 20 years.