If you do not want to or you cannot install the terminfo data, there is the easy workaround to put in your shell initialization script on the remote computer something like "export TERM=xterm-256color".
Ghostty aims to be completely compatible with xterm, so everything should work fine after setting thus TERM, only the newer features of ghostty will not be available.