Garlic will last months if it is dried and "cured" in a dark and relatively cool place. The curing process typically means hanging the garlic so that each head has good air circulation around it. Some authorities recommend leaving the dirt on during the cure, then brushing it and any loose skin away.
However, all of our produce has to come into the house. We don't have a good work area other than the kitchen--not yet, anyway. So I clean the garlic before curing it. A thin jet of water from the garden hose quickly washes away the dirt and removes a layer of skin, revealing the pearly white heads underneath.