In this paper we define and study rank metric codes endowed with a Hermitian form. We analyze the duality for F q 2-linear matrix codes in the ambient space (F q 2) n,m and for both F q 2-additive codes and F q 2m-linear codes in the ambient space F n q 2m. Similarly, as in the Euclidean case we establish a relationship between the duality of these families of codes. For this we introduce the concept of q mduality between bases of F q 2m over F q 2 and prove that a q m-self dual basis exists if and only if m is an odd integer. We obtain connections on the dual codes in F n q 2m and (F q 2) n,m with the corresponding inner products. In particular, we study Hermitian linear complementary dual, Hermitian self-dual and Hermitian self-orthogonal codes in F n q 2m and (F q 2) n,m. Furthermore, we present connections between Hermitian F q 2additive codes and Euclidean F q 2-additive codes in F n q 2m. INDEX TERMS Rank metric codes-Additive rank metric codes-Hermitian rank metric codes This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication.