Do not buy peeled garlic that is refrigerated in the grocery store. Peeled garlic has to be stored in the refrigerator, and because of humidity, it will contain molds easily. So, buy fresh garlic and keep it in a place that has good air circulation.
A great and delicious way to preserve garlic is by preserving it in oil (confit).
To make garlic confit, place a handful of peeled whole cloves of garlic in a saucepan and add enough oil to cover. Add herbs such as thyme or bay leaves if desired. Cook gently over low heat, stirring occasionally, until garlic becomes tender. Do not let the oil become hot enough that the garlic takes on any color. If the oil gets too hot, remove from heat until the oil cools down, then continue.
Once done, transfer the garlic and herbs to a jar, then pour the oil overtop. Seal the jar and transfer to a refrigerator once cooled. This will keep for up to four months.
The easiest way to store garlic at home is in loosely woven baskets or a mesh bag. Garlic with flexible tops can be made into pretty braids to hang. But garlic with a stiff central stalk will shatter if you try to braid it.
Buy fresh garlic bulbs. You know it is fresh garlic when the outer skin is white and papery. Avoid buying garlic that has baby sprouts around it to the soft ones. Soft garlic will not last very long. Keep the fresh garlic at room temperature and not in the refrigerator. This will make them last longer.