Developing single-atomic catalysts with superior selectivity and outstanding stability for CO2 electroreduction is desperately required but still challenging. Herein, confinement strategy and three-dimensional (3D) nanoporous structure design strategy are combined to construct unsaturated single Ni sites (Ni-N3) stabilized by pyridinic N-rich interconnected carbon nanosheets. The confinement agent chitosan and its strong interaction with g-C3N4 nanosheet are effective for dispersing Ni and restraining their agglomeration during pyrolysis, resulting in ultrastable Ni single-atom catalyst. Due to the confinement effect and structure advantage, such designed catalyst exhibits a nearly 100% selectivity and remarkable stability for CO2 electroreduction to CO, exceeding most reported state-of-the-art catalysts. Specifically, the CO Faradaic efficiency (FECO) maintains above 90% over a broad potential range (-0.55 to -0.95V vs. RHE) and reaches a maximum value of 99.6% at a relatively low potential of -0.67V. More importantly, the FECO is kept above 95% within a long-term 100h electrolyzing. Density functional theory (DFT) calculations explain the high selectivity for CO generation is due to the high energy barrier required for hydrogen evolution on the unsaturated Ni-N3. This work provides a new designing strategy for the construction of ultrastable and highly selective single-atom catalysts for efficient CO2 conversion.