Buy the appropriate materials and tools, including the main gas pipe, the flexible pipe that runs from the main line to the appliance and new valves to control the gas flow. After turning off the gas, coat the gas line with pipe glue or tape, and then add valves and piping to the gas line until a gas pipe has been created that reaches the desired location. Check the pipe for leaks, and then attach to the appliance.
Check the existing gas line to make sure the purchased fittings and valves fit appropriately and permanently with the new piping. For example, older houses have steel threaded pipes that will not connect with all types of new valves and fittings.
Use measuring tape to check how long the gas pipe needs to be. If the pipe length needs to be adjusted, use heavy-duty pipe cutters to trim any excess length of pipe.
To check the pipe for leaks, mix dish soap with water, and then brush the mixture along any fitting or valve connected to the gas pipe. If the mixture bubbles, then air is escaping through the pipe and there is a leak. Tighten any fittings or valves where this occurs. For extra security, re-attach these fixtures to the pipe with pipe glue or tape to create an air tight seal.