In light of the growing concerns of global climate change, the pace of transportation electrification has greatly accelerated in recent years as an effort towards net-zero greenhouse gas (GHG) emissions. However, it remains unclear how to effectively deploy and operate public charging infrastructure to best serve an electrified transportation system within a multi-modal context while maximizing the benefits of decarbonization. This is especially true when considering the GHG emitted by generating one kWh of electricity, i.e. the electricity carbon intensity, varies across a day due the change of generation mix between renewable and fossil fueled resources. To address this question, we propose a mechanism of shared charging hubs that can provide holistic energy management for both electric buses (EBs) and passenger electric vehicles (EVs). The deployment and operation of shared charging hubs is determined by a new spatio-temporal optimization model which aims to minimize GHG emission given a budget limit while avoiding the occurrence of massive spikes in peak power demand. This is achieved by coherently accommodating the charging demand of EBs and EVs, and explicitly integrating the time-varying electricity carbon intensity and vehicle-to-grid (V2G) technology. To demonstrate its effectiveness, the model is applied to the bus fleets operated by seven transit agencies and the park-and-ride facilities (for EVs) near twelve rail transit stations in Contra Costa County, California, USA. The results show that the shared charging hubs can lead to significant GHG emission reduction while mitigating the peak electricity demand. This research will help policymakers and transportation agencies make more informed decisions regarding the planning and design of charging infrastructure.