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 randomization tests and Bayesian modeling to quantify the degree of parallelism and study its relationship with ecology and genetics. Our results show that the probability of parallel adaptation to climate among species of Timema stick insects is shaped collectively by shared ecology and genomic background. Specifically, the probability of genetic parallelism decays with divergence in climatic (i.e., ecological) conditions 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.