Fence off gardens and trees so that porcupines cannot get to them to damage foliage. If you have a deck, make sure that porcupines cannot crawl beneath it by fencing it off or using wire to block its entry.
Encourage trees to grow leafy closed canopies by cutting back on tree trimming and by watering and fertilizing the trees in your yard. Closed canopies discourage porcupines from entering the area.
Use wood preservatives on your deck and wooden outdoor structures. Wood preservatives may repel porcupines.
Sprinkle a porcupine repellent around your yard. Non-toxic porcupine repellants, like Shake-Away, contain the scent of porcupine predators, such as the fox, and are sold in pellet form.
Spray plants with a pest repellent. Spray repellents, like Ro-pel, give plants a bitter taste to discourage porcupines and other pests from gnawing on them.