I think it hurts because you're putting your gliss finger too deep into the keybed. I was taught to just lightly skim the surface with the fingernail. You feel the "vibration" as your nail hits each key, but it is hardly painful. I would suggest that for an upward gliss, you lean your body slightly to the left (or more than slightly depending on where the starting point is), put your middle finger and thumb into a "pinching" shape, and then slide your hand lightly up the keys making sure that the nail on your middle finger is facing in the direction you're going, and at a slight angle. The "pinching" shape simply means that you're putting your thumb behind the middle finger to support it. Also, make it a whole body movement. A gliss is just as much torso as it is arm.
For a downward gliss, do everything in reverse: lean to the right, and use your thumb with the index or middle finger behind it. Like anything else, it takes some focus at first to do it right every time, because the tendency is to dig right into the keys on a gliss. Hope that helps.
Peace,
Bri