It's hard to pet a porcupine,
due to the nature of its design.
But if you must,
first win its trust,
then pet very slowly down its spine.
Actual article on topic.
Also, on a festive note, a video of a very cute porcupine chowing down on one of those mini-pumpkins.