How do I get rid of the pain on my nose from getting hit while wearing glasses?

Patience. You probably have a bruise on the bridge of the nose. Assuming that the vision is fine, there are no cuts or anything which might endanger the eye, and the nose is not fractured, then you just have to wait it out. Ice for a couple of days and then it will get better. A modest pain reliever might help like tylenol (acetaminophen) (not Aspirin as it can stimulate bleeding.).
Ice and time. The nose is very sensitive. It will take a little while. There are methods to redirect the glasses pressure with padding.

Related Questions

I have dark marks on my face that I just can't get rid of. They are mostly near both sides of my nose due to wearing glasses. What can I do?

Ecchymosis. If the marks are in fact due to constant pressure from the glasses, you will need to consider changing your glasses, using contacts or giving your skin as much rest as possible and changing the rest position of the glasses often. You can also try applying Arnica lotion you can get from health store (GNC, Whole foods, etc.) since it may be due to ecchymosis rather than PIH.