For thermal couple replacements, your best bet is to (a) follow bro Satil's advice an shut of the main gas line valve; then (b) shut off the gas controller valve one ((look like this):
before you replace your thermalcouple.
Additional notes to help you with the work:
(a) additional lubricant if you have difficulties undoing the thermalcouple's flare nut from the valve's seat (which sometimes happen due to oxidation, dissimalar metal you know. Add 1 drop of 3-in-1 oil on the thread before you twist the flare nut to undo it.
When you break the nut loose, you should then be able to undo the thermalcouple's nut by hand (finger). If you cannot do so, don't force it. The gas valve seat is made of soft aluminium alloy, and can be easily damaged (cross-threaded) if you force it to, which may ended up calling on a gas fitter to come and replace the whole thing with a new one... ($$$$$$$$$)
(b) do a rough measurement RE: the length of the thermalcouple and go buy the exact length. Normally, hardware stores typically stocked sizes of 18", 24" and 36", with 24" being the most common type. Any brand with packaging sez: "universal fit" will do
Don't buy too long or too short.
(c) if there's ever the need to undo the gas fitting (flare nut) on the pilot light end in order for you to replace the thermalcouple, be absolutely certain that when you put everything back together, don't force the pilot light gas fitting (to jet) part too loose or too tight... You must have that proper feel when tightening the flare nut or otherwise: you'll get into trouble.
(d) when installing the electrical end of the thermalcouple (back onto the gas valve body---thermalcouple seat), straighten the copper wire so that the end contact and the nut can seat properly and can be turned using finger (only). If it exhibits any signs of difficulty when turning the flare nut into the gas valve seat, STOP! undo it and check the orientation of the nut -to-seat again. Oftentimes, one can cross-thread (ruining the entire gas valve) during that process.
After you finger tight smoothly to the bottom of the seat, then get a box-end wrench, tighten the nut by 1/8 to 1/4 of a turn (1/4 being max).
(e) proceed to the reverse process by first (check that the gas controller valve on your furnace is shut off completely) turning on the main gas feed valve, then with a long neck lighter or something, light the pilot light and see if it stays on after 20 seconds or so.