Turn off the gas supply from the closest shutoff valve or at the gas main.
Thread the end of the pipe with a pipe threader if the pipe is not already threaded. Insert the end of the pipe into the threader and turn the threader clockwise until about an inch of the end of the pipe has been threaded. Remove the pipe threader from the end of the pipe.
Smear pipe dope onto the threads to help seal the connection when the cap is installed.
Twist the cap onto the end of the pipe by hand until it is snug. Turn the cap clockwise to install it on the end of the pipe.
Attach a pipe wrench to the gas line 6 inches below the cap. Use another pipe wrench to turn the cap while holding the gas line securely in place. Tighten the cap completely. Restore gas service.