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 which is connected to the router.

In the macOS terminal, I noticed that the 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.

I suppose both computers were assigned the same IP address, maybe because they were connected to the same universal dock.

I fixed that with

sudo scutil --set HostName Tadhgs-Air

and closing and reopening Terminal.app.

Another day, another mystery.