Evolution can repeat itself, resulting in parallel adaptations in independent lineages occupying similar environments. Moreover, parallel evolution sometimes, but not always, uses the same genes. Two main hypotheses have been put forth to explain the probability and extent of parallel evolution. First, parallel evolution is more likely when shared ecologies result in similar patterns of natural selection in different taxa. Second, parallelism is more likely when genomes are similar because of shared standing variation and similar mutational effects in closely related genomes. Here we combine ecological, genomic, experimental and phenotypic data with Bayesian modelling and randomization tests to quantify the degree of parallelism and its relationship with ecology and genetics. Our results show that the extent to which genomic regions associated with climate are parallel among species of Timema stick insects is shaped collectively by shared ecology and genomic background. Specifically, the extent of genomic parallelism decays with divergence in climatic conditions (that is, habitat or ecological similarity) and genomic similarity. Moreover, we find that climate-associated loci are likely subject to selection in a field experiment, overlap with genetic regions associated with cuticular hydrocarbon traits and are not strongly shaped by introgression between species. Our findings shed light on when evolution is most expected to repeat itself.