I have a server with fqdn git.mydomain.com (this is in DNS) but I don't really want the machine to have git as its hostname.
It might not be clear exactly what I want. Or maybe I don't really understand how all this is supposed to work, but my understanding is that
Should return the fqdn of the server, which in this case is git.mydomain.com
And plain old hostname should return the UNqualified hostname of the server. Every resource I can find says the the unqualified name should be the start of the fqdn but this seems annoying and inconvenient.
I would like
To return git.mydomain.com since that really is the fqdn of the server
But I would like hostname to just return mycustomhostname.
At the moment I have /etc/hostname set as 'mycustomhostname', and in /etc/hosts I have
127.0.0.1 mycustomhostname 126.96.36.199 git.mydomain.com
Where 188.8.131.52 is my public IP. However, this results in the hostname command returning mycustomhostname (which is fine), but hostname -f returns mycustomhostname as well, which is not correct, since the fqdn is git.mydomain.com.
The main reason for this is that when I am ssh'ing in to the server I would like the bash shell to say
myusername@git (Which is what ever guide everywhere seems to indicate it should be).
Simply because it will make it easier for me to know what server I am working with. If I have another server for git repositories (say, git.mydomain2.com) and follow the conventions I see everywhere, then if I ssh'd in to that server bash would also say
Which is confusing for me.
How do I properly have a different hostname to the server's fqdn?
This is on Debian Linux btw.