Based on first-principles calculations, we find that substitutional nitrogens in GaAs act as hydrogen traps, forming N-H complexes. For low H concentrations, we propose the formation of N-monohydride complexes, which explain various experimental features such as the Fermi level dependence of the formation of N-H complexes, H vibrational frequencies, isotope shift, and photoconversion of the complexes. For very high H concentrations, the energetically favorable structure is an optically inactive N-dihydride complex, which suppresses N-related photoluminescence lines in N-containing GaAs, and induces a blueshift of the band gap in GaAs1-xNx alloys.