Fix the config of fish shell when using ghostty

I’m using fish shell1 and ghostty2 together. If I use the ssh command to connect to a remote machine, I got this warning:

weli@mini ~
❯ ssh weli@192.168.0.113
(weli@192.168.0.113) Password:
Last login: Fri Jan  3 01:25:29 2025 from fe80::18ee:f404:c997:b86d%en0
warning: Could not set up terminal.
warning: TERM environment variable set to 'xterm-ghostty'.
warning: Check that this terminal type is supported on this system.
warning: Using fallback terminal type 'xterm-256color'.
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
weli@arm13 ~
❯

To make things worse, the above warning will cause the scp command to fail:

❯ scp foo.txt weli@192.168.0.113:~/
(weli@192.168.0.113) Password:
scp: Received message too long 1500476704
scp: Ensure the remote shell produces no output for non-interactive sessions.

To fix this problem, I added this line into ~/.config/fish/config.fish:

set TERM xterm-256color

After the above config is added, then the warnings when connecting to remote machine disappeared.

My Github Page: https://github.com/liweinan

Powered by Jekyll and Theme by solid

If you have any question want to ask or find bugs regarding with my blog posts, please report it here:
https://github.com/liweinan/liweinan.github.io/issues