From the two-band Ginzburg-Landau theory, we study the temperature dependence of upper critical field on the layered superconductor NbS2. The temperature dependence of the anisotropic parameter for upper critical filed is also obtained. All the results fit the experimental data well in a broad temperature range. Thus our results show strong evidence that two-gap scenario is better to account for the superconductivity of NbS2. The anisotropic parameter of the upper critical field for NbS2 starts to decrease from 5.0 K, and this behavior is similar to those of MgB2 and NbSe2. However for NbS2 this number is about 7.3, which is much greater than the ones in MgB2 and NbSe2. The results also show that the band with the larger gap exhibits that the effective mass ratio between the in-plane and out-of-plane direction is about 54, and the other band indicates that the effective mass ratio is almost isotropic.