We propose a scheme to compensate dynamically the intrinsic chirp of the attosecond harmonic pulses. By adding a weak second harmonic laser field to the driving laser field, the chirp compensation can be varied from the negative to the positive continuously by simply adjusting the relative time delay between the two-color pulses. Using this technique, the compensation of the negative chirp in harmonic emission is demonstrated experimentally for the first time and the nearly transform-limited attosecond pulse trains are obtained.