Although hydrogen embrittlement has been observed and extensively studied in a wide variety of metals and alloys, there still exist controversies over the underlying mechanisms and a fundamental understanding of hydrogen embrittlement in nanostructures is almost non-existent. Here we use metallic nanowires (NWs) as a platform to study hydrogen embrittlement in nanostructures where deformation and failure are dominated by dislocation nucleation. Based on quantitative in-situ transmission electron microscopy nanomechanical testing and molecular dynamics simulations, we report enhanced yield strength and a transition in failure mechanism from distributed plasticity to localized necking in penta-twinned Ag NWs due to the presence of surface-adsorbed hydrogen. In-situ stress relaxation experiments and simulations reveal that the observed embrittlement in metallic nanowires is governed by the hydrogen-induced suppression of dislocation nucleation at the free surface of NWs.