Two men have been rescued after being stranded on a mountain ledge for more than seven hours.

The two men, aged 26 and 36, became trapped on the ledge around lunchtime on Saturday following a rockfall at Mt Sturgeon in Victoria's west.

Police say they believe the men veered off a track before managing to get to the ledge where they called triple zero.

After it was decided it was unsafe for a chopper to land, police search and rescue specialist rope teams climbed down to the men.

It then took rescue teams around two hours to get the men from the ledge to the bottom of the mountain.

Neither man is injured, police say.

AAP