In situ X-ray diffraction was used to identify the crystal structures of as-deposited and hydrogenated MgyTi100-y thin film alloys containing 70, 80 and 90 at.% Mg. The preferred crystallographic orientation of the films in both the as prepared and hydrogenated state made it difficult to unambiguously identify the crystal structure up to now. In this work identification of the unit cells was achieved by in situ recording diffraction patterns at various tilt angles. The results reveal a hexagonal closed packed structure for all alloys in the as-deposited state. Hydrogenating the layers under 105 Pa H2 transforms the unit cell into face centered cubic for the Mg70Ti30 and Mg80Ti20 compounds, whereas the unit cell of hydrogenated Mg90Ti10 has a body centered tetragonal symmetry. The (de)hydrogenation kinetics changes along with the crystal structure of the metal hydrides from rapid for fcc-structured hydrides to sluggish for hydrides with a bct symmetry and emphasizes the influence of the crystal structure on the hydrogen transport kinetics.