Repetitive and proportional-resonant controllers can effectively reject grid harmonics in grid-connected inverters because of their high gains at the fundamental frequency and the corresponding harmonics. However, the performances of these controllers can seriously deteriorate if the grid frequency deviates from its nominal value. Non-ideal proportional-resonant controllers provide better immunity to variations in grid frequency by widening resonant peaks at the expense of reducing the gains of the peaks, which reduces the effectiveness of the controller. This paper proposes a repetitive control scheme for grid-connected inverters that can track changes in grid frequencies and keep resonant peaks lined up with grid frequency harmonics. The proposed controller is implemented using a digital signal processor. Simulation and practical results are presented to demonstrate the controller capabilities. Results show that the performance of the proposed controller is superior to that of a proportional-resonant controller.