Working on a steep roof is dangerous, and you should never do this without a safety mechanism to prevent you from falling, especially if the roof is high. You can buy roof brackets to support a ladder so you may safely climb it to make repairs, and these should be fastened securely to the roof rafters. Even with brackets in place, though, it's a good idea to invest in a roof harness.
Set an extension ladder on the side of the house so it extends 3 feet above the bottom of the roof. Make sure the bottom of the ladder is level and stable. It should be slanted so the base is 1 foot from the house for every 4 feet of vertical height.
Secure the base of the ladder to the side of the house by tying one end of a rope to the bottom rang and the other end to a secure place on the house. Screw eye-hooks into the house siding and tie the rope to them, if there is no alternative. This will prevent the ladder from sliding out when you are on it. Climb the ladder and secure the top by tying it to eye-hooks screwed into a solid surface, such as the roof fascia or the siding.
Working from the top of the ladder, nail roof brackets into the roof rafters about 18 inches up from the edge of the roof and about 4 feet apart. A roof bracket is a long metal hook with an elongated base that slides under a shingle to attach to the roof. Lift a shingle and slide the end of a bracket underneath, then pound 20d nails through the slots in the base of the bracket directly into the rafter.
Slide a length of 2-by-6-inch lumber into the notches on the ends of the brackets. These are sized to hold the wood vertical and secure.
Carry a small, lightweight extension ladder up to the roof and place it flat with the bottom set firmly against the 2-by-6-inch brace.
Step onto the roof on the upper side of the brace, so you can use it for support if you slip. Climb the ladder to the top of the roof and install a harness onto the roof according the manufacturer's instructions. Use the harness as an extra means of protection while you're working on the ladder.
When you're finished working and have taken away the ladder and harness, remove the brackets by climbing off the roof and removing the 2-by-6-inch brace, then pounding each bracket straight up towards the top of the roof and lifting it off the nails. Leave the nails pounded down so they don't leave a hole in the roof.