If your gear works when the ignition is turned off, then the issue is with the clutch. Confirm it by checking the play in your clutch.
The most common reason behind this will be the air gap due to improper clutch cable assembly. Or, if your car has crossed 50k km after the clutch change, you might need to replace the clutch.
If you are stuck somewhere, try pumping the clutch repeatedly for 3-5 minutes, then try to change the gear. If that's not working, give the car some time to cool off, at least an hour, then you will be able to do the shifting for 10-15 km.