Hickson compact groups (HCGs) constitute an interesting extreme in the range of environments in which galaxies are located, as the space density of galaxies in these small groups are otherwise only found in the centres of much larger clusters. The work presented here uses Lick indices to make a comparison of ages and chemical compositions of galaxies in HCGs with those in other environments (clusters, loose groups and the field). The metallicity and relative abundance of `α-elements' show strong correlations with galaxy age and central velocity dispersion, with similar trends found in all environments. However, we show that the previously reported correlation between α-element abundance ratios and velocity dispersion disappears when a full account is taken of the abundance ratio pattern in the calibration stars. This correlation is thus found to be an artefact of incomplete calibration to the Lick system. Variations are seen in the ranges and average values of age, metallicity and α-element abundance ratios for galaxies in different environments. Age distributions support the hierarchical formation prediction that field galaxies are on average younger than their cluster counterparts. However, the ages of HCG galaxies are shown to be more similar to those of cluster galaxies than those in the field, contrary to the expectations of current hierarchical models. A trend for lower velocity dispersion galaxies to be younger was also seen. This is again inconsistent with hierarchical collapse models, but is qualitatively consistent with the latest N-body smoothed particle hydrodynamics models based on monolithic collapse in which star formation continues for many Gyr in low-mass haloes.