Since I am new here and I cannot comment above I just write my comment as a small answer. I think in your question there is a small mistake. You ask how many degrees of freedom are there in a Yang-Mills theory although you want to ask how many polarizations does the gluon have. First of all, the number of generators of the gauge group will be the number of gauge bosons you will get. $SU(N)$ groups have indeed $N^2-1$ generators, except $U(1)$ that has one. In QED this corresponds to the photon, in $SU(2)$ to three gauge bosons (not exactly the W's and the Z since these are produced by mixing $SU(2)_L$ with $U(1)_y$), and in $SU(3)$ there are 8 gluons as Siva already told you.
Now to your question, how many polarizations do these gauge bosons have. Let us start with a massive vector boson. We can define its helicity states at the rest frame and then of course boost to the frame that the particle moves. Under this boost, the longitudinal polarization has a term $E/m$ (where $E$ the energy and $m$ the mass of the particle) that goes to infinity when the mass of the particle goes to zero. This would cause problems concerning the unitarity of the theory since the contrubutions in the matrix elements would be huge. What one can do is arrange the interactions of the theory such that the contributions from longitudinal polarizations are suppressed by a factor of the order $m/E$. In the case now the vector boson is strictly massless, the longitudinal contributions decouple completely. Therefore, massless vector bosons have two physical states of maximal helicity while massive one have three. Gluons are massless and so are photons, while W's and Z are massive.
I hope I helped. I am pretty sure that you can find more details even in wikipedia if you want.