Lower limb exoskeletons (LLEs) have demonstrated their potential in delivering quantified repetitive gait training for individuals afflicted with gait impairments. A critical concern in robotic gait training pertains to fostering active patient engagement, and a viable solution entails harnessing the patient’s intrinsic effort to govern the control of LLEs. To address these challenges, this study presents an innovative online gait learning approach with an appropriate control strategy for rehabilitation exoskeletons based on dynamic movement primitives (DMP) and an Assist-As-Needed (AAN) control strategy, denoted as DMP-AAN. Specifically tailored for post-stroke patients, this approach aims to acquire the gait trajectory from the unaffected leg and subsequently generate the reference gait trajectory for the affected leg, leveraging the acquired model and the patient’s personal exertion. Compared to conventional AAN methodologies, the proposed DMP-AAN approach exhibits adaptability to diverse scenarios encompassing varying gait patterns. Experimental validation has been performed using the lower limb rehabilitation exoskeleton HemiGo. The findings highlight the ability to generate suitable control efforts for LLEs with reduced human-robot interactive force, thereby enabling highly patient-controlled gait training sessions to be achieved.