Preheat the oven to 350 degrees F (175 degrees C).
Bake sweet potatoes in the preheated oven until soft to the touch, about 30 minutes. Remove from the oven and let cool, 15 to 30 minutes.
Remove and discard skins from cooled potatoes. Mash flesh in a large bowl or press through a ricer. Blend in egg, garlic, salt, and nutmeg. Mix in flour, a little at a time, until a soft dough forms.
Bring a large pot of lightly salted water to a boil.
While the water is coming to a boil, make the gnocchi: Roll dough on a floured surface into several long, snake-like logs. Cut logs into 1-inch pieces.
Drop dough pieces into boiling water and cook until they float to the surface. Transfer with a slotted spoon to a serving dish and keep warm until ready to serve.