The temperature dependence of the electron spin $g$ factor in GaAs is investigated experimentally and theoretically. Experimentally, the $g$ factor was measured using time-resolved Faraday rotation due to Larmor precession of electron spins in the temperature range between 4.5 K and 190 K. The experiment shows an almost linear increase of the $g$ value with the temperature. This result is in good agreement with other measurements based on photoluminescence quantum beats and time-resolved Kerr rotation up to room temperature. The experimental data are described theoretically taking into account a diminishing fundamental energy gap in GaAs due to lattice thermal dilatation and nonparabolicity of the conduction band calculated using a five-level kp model. At higher temperatures electrons populate higher Landau levels and the average $g$ factor is obtained from a summation over many levels. A very good description of the experimental data is obtained indicating that the observed increase of the spin $g$ factor with the temperature is predominantly due to bands nonparabolicity.