By controlling the parameters of the system, the effective interaction between different atoms is achieved in different cavities. Based on the interaction, scheme to generate three-atom Greenberger–Horne–Zeilinger (GHZ) is proposed in coupled cavities. Spontaneous emission of excited states and decay of cavity modes can be suppressed efficiently. In addition, the scheme is robust against the variation of hopping rate between cavities.