Using the first-principles exact muffin-tin orbital method in combination with the coherent potential approximation, the crystal structure and site occupation, martensitic transformation, magnetic moments and elastic constants of Co<sub>2+<i>x</i></sub>Ni<sub>1-<i>x</i></sub>Ga, Co<sub>2+<i>x</i></sub>NiGa<sub>1-<i>x</i></sub>, Co<sub>2-<i>x</i></sub>Ni<sub>1+<i>x</i></sub>Ga and Co<sub>2</sub>Ni<sub>1+<i>x</i></sub>Ga<sub>1-<i>x</i></sub>(0 ≤ <i>x</i> ≤ 0.4) alloys with Co and Ni excess at 0 K are systematically investigated. It is shown that most of the austenitic phases of the alloys have <i>X</i>A stable structure, and the excess Co and Ni atoms are occupied in the insufficient atomic positions, and it is inversely occupied only when Ni replaces Ga. With increasing <i>x</i>, the total electron energy of <i>L</i>1<sub>0</sub> relative to <i>X</i>A of only two Ga-insufficient alloys is gradually decreased, the former tetragonal shear elastic constant is gradually increased, while the latter it is gradually decreased. It is indicated that the martensitic transformation is promoted by both Co and Ni replacements of Ga in the energy and mechanics, and it is expected to increase the martensitic transformation temperature. The total magnetic moments (<i>μ</i><sub>tot</sub>) of the <i>X</i>A and <i>L</i>1<sub>0</sub> phases of each alloy are mainly contributed by Co atoms, and Ni atoms are only contributed relatively small part. And the <i>μ</i><sub>tot</sub> of each two phases in the four alloys are in the same relationship with <i>x</i>, the difference between them is not more than about 0.32 <i>μ</i><sub>B</sub> in the same content. The analysis of electronic structure calculations is shown that the spin-down electronic density of states distribution of Co and Ni atoms near the Fermi energy level has contributed significantly to the stability of <i>L</i>1<sub>0</sub> relative to the <i>X</i>A phase, which is attributed to the Jahn-Teller effect. The above results are expected to provide a theoretical reference for the optimal design of the structure and properties of Co<sub>2</sub>NiGa-based ternary alloys on experiments.