First, for a Dirac operator $D$, it extends to a Fredholm operator \begin{equation} D^+\colon H^1(M,E^+)\to L^2(M,E^-), \end{equation} see Lawson-Michelsohn "Spin Geometry", Page 193, Theorem 5.2. Also, a classical result in functional analysis says the index of the Fredholm operator is locally constant, see for instance Lemma 16.18 of https://ocw.mit.edu/courses/18-965-geometry-of-manifolds-fall-2004/8a7e4dd837d1bdd6988e0330babb8c5e_lecture16_17.pdf Therefore, using the above lemma for the family $t\in [0,1]\mapsto tD_0^++(1-t)D_1^+$, the index is constant as required. To see that the Fredholm index \begin{equation} Ind(D^+)=\dim \mathrm{kernel}(D^+)-\mathrm{codim\ range}(D^+) \end{equation} coincides with the one you want, we only need to prove that \begin{equation} \mathrm{codim\ range}(D^+)=\dim \ker(D^-). \end{equation} Now we consider the dual $D^- $ of $D^+$ \begin{equation} D^-\colon L^2(M,E^-)\to H^{-1}(M,E^+), \end{equation} Using Rudin Functional Analysis Theorem 4.12, we get \begin{equation} L^2(M,E^-)=\ker D^-\oplus \overline{\mathrm{range}(D^+)}, \end{equation} and since $D^+$ is Fredholm, its image is closed, $\overline{\mathrm{range}(D^+)} =\mathrm{range}(D^+)$, so \begin{equation} L^2(M,E^-)=\ker D^-\oplus\mathrm{range}(D^+), \end{equation} from which we clearly get $\mathrm{codim\ range}(D^+)=\dim \ker(D^-)$ as required. A subtle point is to distinguish different adjoints, first, \begin{equation} (D^+)^*\colon L^2(M,E^-)\to H^{1}(M,E^+), \end{equation} is defined by \begin{equation} ((D^+)^*s,t)_{H^{1}(M,E^+)}=(s,D^+t)_{L^2(M,E^-)} \end{equation} for $s\in L^2(M,E^-),t\in H^{1}(M,E^+)$. But remember that this adjoint is NOT the way we define $D^-$, because $D^-$ is defined via the $L^{2}(M,E^+)$ product, not the $H^{1}(M,E^+)$ product: \begin{equation} ((D^+)^*s,t)_{L^{2}(M,E^+)}=(s,D^+t)_{L^2(M,E^-)}, \end{equation} that is why $(D^+)^*s$ is in $H^{-1}(M,E^+)$, not $H^{1}(M,E^+)$.