The temperature dependence of the upper critical fields(Hc2(T)) of the two-gapsuperconductors Mg1−xAlxB2 (x = 0, 0.1, 0.2, and 0.3) was obtained by resistivity measurements. TheHc2(T) values were analysed, within the dirty-limit two-gap model, using the calculated electron–phononcoupling constants and Coulomb pseudopotentials. As the Al contents increased, bothTc and Hc2(0) decreased, which was the direct manifestation of the increasingnumber of electrons. At the same time, the three-dimensionalπ bandsbecame much dirtier when Al was doped. In contrast, the intraband scattering of the two-dimensionalσ bands was relatively unaffected by the Al doping. These behaviours could be understood whenthe characters of both bands were considered. In all the samples that we investigated, theσ bands weredirtier than the π bands.