macOS host name weirdness

I have a Macbook, which runs macOS.

I have a work computer, which runs Windows.

I have had both of these computers plugged in to the same universal DisplayLink dock. I have more things to say about this dock, but that’s not relevant right now.

This dock has an ethernet port, which has an ethernet cord connected to the router.

In the macOS terminal, I noticed that the bash prompt has changed from tadhgj@Tadhgs-Air to tadhgj@xxxxxxxxxxxxxxx.

But that’s the hostname of my work laptop?

This reddit thread seems to explain what happened.

Whatever the cause, I fixed it with

sudo scutil --set HostName Tadhgs-Air

and closing and reopening the terminal.

Another day, another mystery.