Crystal and local structures and hydrogen occupation of Mg containing materials, (Mg,Ca)Ni x(x = 2, 3) intermetallic compounds and a MgCo metastable alloy, have been investigated using in-situ and ex-situ X-ray/neutron diffraction and total scattering. A C15 Laves phase (Mg 0.67Ca 0.33)Ni 2 showed isotropic lattice expansion upon hydrogenation. Mg and Ca occupied the same site randomly. It has two hydrogen sites, Mg(Ca) 2Ni 2 site and M(Ca)Ni 3 site. Mg 2CaNi 9, MgCa 2Ni 9, and CaNi 3 compounds consisted of MgZn 2-type (Mg,Ca) 2Ni 4 cell and CaCu 5-type CaNi 5 cell stacking along the c-axis. The MgZn 2-type cell was occupied by only Mg in Mg 2CaNi 9, and randomly occupied by both Mg and Ca in MgCa 2Ni 9. Expansion of this cell strongly depended on the composition: larger expansion was observed in a Ca-rich composition. Local structure of a Mg-Co alloy synthesized by mechanical alloying has been studied using the PDF (Pair Distribution Function) method. The analysis suggested that material contained two 1-2 nm domains with different compositions and local structures, i.e. Mg-rich and Co-rich domains, and hydrogen was located only in the Mg-rich domain.