The invention relates to a method and a device for inhibiting and eliminating leakage current of a photovoltaic grid connection system without a transformer. The device is composed of a leakage current detector, a central controller and a waveform generator, wherein, the central controller is provided with a waveform analyzing circuit, a command current computing circuit and a current tracking control circuit; the waveform generator is provided with a drive circuit and a power module; the leakage current detector is arranged on the direct-current side of an inverter and is connected with the central controller; the central controller is used for analyzing and processing the leakage current waveform and generating compensatory current control signals; and the waveform generator is arrangedin a photovoltaic array and is connected with the output end of the current tracking control circuit of the central controller, and is used for injecting the corresponding compensatory current generated according to the command of the central controller into a photovoltaic system. In the invention, the compensating current the size of which is the same as that of the leakage current, and the phase position of which is opposite to that of the leakage current is generated through detecting, analyzing and processing the leakage current waveform. The compensating current is overlaid and offset with the leakage current after being injected with circuit, thus achieving the purpose of inhibiting and eliminating the leakage current; and the method and device provided by the invention has the characteristics of real-time monitoring, tracking, less dynamic compensation power consumption and smaller environment influence, can effectively inhibit and eliminate the leakage current, and has large application prospects and economic effect.