We propose a way for transferring Greenberger–Horne–Zeilinger (GHZ) entangled states from n qubits in one cavity to another n qubits in the other cavity. It is shown that n-qubit GHZ states $$\alpha \left| 00\ldots 0\right\rangle +\beta \left| 11\ldots 1\right\rangle $$ α 00 … 0 + β 11 … 1 with arbitrary degree of entanglement can be transferred deterministically. Both of the GHZ state transfer and the operation time are not dependent on the number of qubits, and there is no need of measurement. This proposal is quite general and can be applied to accomplish the same task for a wide range of physical qubits. Furthermore, note that the n-qubit GHZ state $$\alpha \left| 00\ldots 0\right\rangle +\beta \left| 11\ldots 1\right\rangle $$ α 00 … 0 + β 11 … 1 is a quantum-secret-sharing code for encoding a single-qubit arbitrary pure state $$\alpha \left| 0\right\rangle +\beta \left| 1\right\rangle $$ α 0 + β 1 . Thus, this work also provides a way to transfer quantum secret sharing from n qubits in one cavity to another n qubits in the other cavity.