The absorption of IR radiation is due to vibrations of molecules. When a vibration causes change in charge distribution (or dipole moment to be more specific) the IR radiation is absorbed.
Generally, hetero-polar molecules, like $H_2O \; and \; CO_2$$\rm H_2O$ and $\rm CO_2$, have permanent dipole moment. The external oscillating electric field in this case perturbs the Hamiltonian and causes IR absorption. Hence, they contribute to "Green House effect" by absorbtionabsorption of heat.
$H_2O$$\rm H_2O$, which is non-linear molecule, has three fundamental modes of vibrations. Symmetrical Stretching, asymmetrical Stretching and scissoring (bending). $CO_2$$\rm CO_2$, which is linear molecule, has four fundamental modes of vibrations. Symmetrical stretching, asymmetrical stretching and two degenerate scissoring modes, in planes perpendicular. The symmetric stretching mode in $CO_2$$\rm CO_2$ does not produce or absorb any IR, as it does not cause change in dipole moment, but other modes do change charge distribution causing absorption of IR.
Well, the homo-polar molecules, like $N_2 \; and \; O_2$$\rm N_2$ and $\rm O_2$, does not have any permanent dipole moment. The external oscillating electric field does not perturb the Hamiltonian for nuclear motion, and does not absorb IR, though it perturbs Hamiltonian for electronic motion. Hence, do not contribute for "Green House effect".