Running out of ghee is common, since it's less likely to already be in a Western pantry than butter or oil. The good news is that most substitutes are close at hand — the right choice just depends on why the recipe wanted ghee in the first place.
The closest substitute: clarified butter
Ghee is clarified butter cooked a little further, so plain clarified butter (butter with the water and milk solids removed, but not browned) is the nearest match in both flavor and high-heat performance. If you have the time, you can make a rough approximate yourself: melt butter slowly, skim off the foam, and pour off the clear fat, leaving the milky residue behind.
If you're out of time: neutral oil + butter
For a fast substitute, a mix of a neutral high-smoke-point oil (like avocado or refined sunflower oil) with a small amount of regular butter gets you closer than oil alone — the oil handles the heat tolerance ghee is known for, and the butter adds back some of the dairy richness ghee has that oil lacks.
Plain butter, with a caveat
Regular butter works flavor-wise but not heat-wise — its lower smoke point means it can burn where ghee wouldn't. It's a reasonable substitute in recipes where ghee is used at low-to-medium heat or added at the end (finishing a dal, for example), but a riskier one for high-heat searing or a tempering step, where the milk solids in butter are more likely to scorch.
For a dairy-free version
Coconut oil is the most common dairy-free substitute — it shares ghee's high smoke point and semi-solid texture at room temperature, though it brings its own distinct coconut flavor that ghee doesn't have. It works best in dishes where a little coconut flavor won't clash with the rest of the ingredients.
Does the substitute change the dish?
In dishes where ghee is a background cooking fat, most of these substitutes work without anyone noticing. In dishes where ghee's specific nutty, toasted flavor is meant to come through — finished with a spoonful on top, for instance — no substitute fully replicates it, and the dish will taste noticeably different.