Place garlic cloves and oil in a small saucepan, making sure garlic is submerged. Cook, stirring occasionally, over low, until garlic softens and begins to take on color, about 12 minutes. Remove from heat and set aside for oil to cool completely, 25 to 30 minutes (garlic will continue to cook for a little longer). Using a slotted spoon, transfer garlic to a small bowl and mash with a fork until smooth (about 1 tablespoon). Transfer oil to a jar or lidded container. Set both aside separately.
Stir together yeast and 1 ¾ cups lukewarm water in a measuring cup and set aside until foamy, about 5 minutes.
Whisk together flour, Pecorino, salt, and pepper in a large bowl. Add mashed garlic and yeast mixture. Stir with a flexible spatula until a sticky ball forms. Drizzle 1 tablespoon reserved garlic oil on top of dough ball and use fingers to gently spread oil all over surface of dough. Cover with plastic wrap and refrigerate until doubled in size, at least 8 hours or up to 2 days. Store remaining reserved garlic oil, covered, at room temperature until ready to use.
Pour 2 tablespoons reserved garlic oil into bottom of a 12-inch round cake pan or 9- x 13-inch baking pan. Using your dominant hand, smear oil over bottom and up sides of pan — this will also oil your hand, which is important for the next step.
With dough still in the bowl, use your oiled hand to pull the sides of the dough out and over to the center. Rotate the bowl and repeat a few times to firm up dough, then transfer it to oiled pan. Turn dough to coat it in oil. Cover lightly with clean kitchen towel; let stand, at room temperature, until it is soft and airy with a puffy surface and has expanded to fit entire pan, 1 to 2 hours. (If using the rectangular baking pan, you may need to press dough to fit entire pan.)
When dough is nearly ready, preheat oven to 450˚F.
Drizzle 2 tablespoons reserved garlic oil on top of dough, then press your fingertips and thumbs into risen dough a few times to create deep, oily dimples all over. Layer potatoes on top, slightly shingled. Tear off small pieces of rosemary sprig and tuck in and around potatoes. Drizzle top with remaining 2 tablespoons reserved garlic oil and sprinkle with flaky sea salt.
Bake until potatoes are golden brown, 30 to 35 minutes. Place pan on a wire rack to cool about 5 minutes before lifting focaccia out of the pan to cool further on the rack.
