During a recent mtb ride, I got cramps in both quads about 13 miles into a 17.5 miler while climbing. I stretched them and my calves and hammies at the top of that climb before going down. I then cramped later walking up a steep HAB trail. I couldn't straighten out my legs or my quads would cramp. I was forced to just stand there semi-crouched or slowly shuffle. Near the top, the cramps subsided and it felt good to get back on and ride after that. For what it's worth, I never cramp while riding and was well hydrated (or so I thought), had consumed 2 gels and a cliff bar during the ride. So what gives? Electrolyte issue? Maybe I just rode harder than normal with all the other riders around as this was an organized ride?
You overcooked your legs. When you get into better condition, this will stop. IMO, the best way for a MTB rider to do that is to train on a road bike.
Interesting. Although is was not a race, everyone was trying to crush each other on the climbs. I certainly was trying to hold off guys from catching or passing me. I have a road bike but need to get on it more than I am. I did a recovery ride on it today and it was a welcome change.