It is well known, both theoretically and experimentally, that alloying MgH$_2$ with transition elements can significantly improve the thermodynamic and kinetic properties for H$_2$ desorption, as well as the H$_2$ intake by Mg bulk. Here we present a density functional theory investigation of hydrogen dissociation and surface diffusion over Ni-doped surface, and compare the findings to previously investigated Ti-doped Mg(0001) and pure Mg(0001) surfaces. Our results show that the energy barrier for hydrogen dissociation on the pure Mg(0001) surface is high, while it is small/null when Ni/Ti are added to the surface as dopants. We find that the binding energy of the two H atoms near the dissociation site is high on Ti, effectively impeding diffusion away from the Ti site. By contrast, we find that on Ni the energy barrier for diffusion is much reduced. Therefore, although both Ti and Ni promote H$_2$ dissociation, only Ni appears to be a good catalyst for Mg hydrogenation, allowing diffusion away from the catalytic sites. Experimental results corroborate these theoretical findings, i.e. faster hydrogenation of the Ni doped Mg sample as opposed to the reference Mg or Ti doped Mg.