If it won t light at all see the article fixing hot water heater gas valves for the issues surrounding this device.
Gas water heater ignition not working.
A bad gas valve will not allow any gas to go to the burner or pilot light.
Either you own a rinnai tankless water heater navien ao smith takagi bosch or any other on demand model use this article and get the necessary information on how to deal with the problem ignition failure which is the main reason why users complain about the flame loss water heater not working no hot water and alike.
Make sure the wire is connected at the bottom of the push button that makes the igniter spark.
The other less common problem would be the gas valve.
When trying to light the heater be sure to put the gas valve on the water heater in the pilot position and hold down on the pilot button.