You can buy soap for mechanics at an automotive store but I find clean oil is one of the best things for removing dirty oil. It basically dilutes the dirty oil and pulls it out of the pores (and porous surfaces). Rub it in really good, use something like a folded business card to 'scrub' under the nail (be gentle and rub the oil in under the nail). A toothbrush works well too but it's too easy to stab under the nail with one of the bristles. Then wash up with a good dish soap (or mechanics soap). Sometimes a little bit of lighter fluid (naphtha) can be used after the oil treatment, for troublesome spots but has a tendency to dry out the skin and nails. It's important to use enough oil that it doesn't become dirty itself. I usually add clean oil as I go (if they are really bad). Generally I try to match the oil with the oil on my hands (i.e. if working on car I use motor oil, if working on a sewing machine I would use machine oil, etc.).
One Ring to rule them all, One Ring to find them, One Ring to bring them all, and in the darkness bind them.