In Drosophila, germ cells migrate in embryonic development from the lumen of the developing gut towards the overlying mesoderm, where they enter the gonads. The gene wunen is responsible for guiding the germ cells early in this process. Here we report that the protein Wunen has two properties that allow it to use repulsion to guide the germ cells. Wunen can transform a permissive cellular environment into a repulsive one, and is expressed in the gut in a pattern that guides germ cells towards the mesoderm. Wunen shows strong similarity to the enzyme type 2 phosphatidic acid phophatase (PAP2)4, suggesting that it is involved in lipid metabolism.