Understanding how animals avoid overturning and rolling in motion to maintain movement stability and to accommodate their habitat and the mechanisms of movement in these habitats is a matter of concern. Gecko climbs a more inclined substrate by lowering the speed; meanwhile, the duty factor is increased with the increase of the incline angle, indicating that the gecko switches the diagonal gait when climbing on the shallow inclines to the triangular gait when on the inverted surface. The overturning impulse moment is increased with an increase of the incline angle. On inclines larger than 90°, the positive and negative overturning impulse moments are increased significantly and show obvious differences. The maximum value of rolling impulse moment on the surface at 180° can reach 15 times that of the minimum value on the surface at 90°, and the positive and negative rolling impulse moments at the inclined surface of 120–180° have obvious differences. The above results show that on shallow inclines, the low centre of mass and the flat posture of the gecko can effectively improve locomotion stability; simultaneously, through the timely conversion of the limb function, the overturning/rolling impulse moments are low, which greatly reduces the probability of overturning/rolling during locomotion. However, on inverted inclines, the gecko takes full advantage of the flexibility of body and limbs to delay the occurrence of rolling and overturning, and actively cooperates with the adjustment of the gait, using the alternating change of gait to avoid overturning and rolling.