Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does Git Bash get all its host mappings from?

I'm using Git Bash in Windows 8. I can see it has copied C:\Windows\system32\drivers\etc\hosts over to /etc/hosts. Note that /etc/hosts is not a link to C:\Windows\system32\drivers\etc\hosts - you can prove this to yourself by modifying C:\Windows\system32\drivers\etc\hosts and seeing that /etc/hosts is not immediately modified. My guess is that /etc/hosts is copied over from C:\Windows\system32\drivers\etc\hosts when git bash is launched, but that's really irrelevant to this question.

My real question here is why there are other known hosts which do not appear in either of these files:

$ ping host-not-in-files
Pinging host-not-in-files [192.168.3.3] with 32 bytes of data:
Reply from 192.168.3.3: bytes=32 time<1ms TTL=64
Reply from 192.168.3.3: bytes=32 time<1ms TTL=64
^C

Where is Git Bash getting the mapping from host-not-in-files to 192.168.3.3 from?

Note: host-not-in-files is not a literal string - I could just as well have written ping bob or ping fred here - it's just intended to be a hostname that cannot be found in either C:\Windows\system32\drivers\etc\hosts or /etc/hosts. I don't want to post the actual string I use in my PC into stackoverflow for security reasons - just the same reason as why 192.168.3.3 is not a real IP address in my network.

Also note that I have no problems with using the hosts in either C:\Windows\system32\drivers\etc\hosts or /etc/hosts - these are being mapped fine by Git Bash. I just want to know where the other mappings are occurring.

like image 855
mulllhausen Avatar asked Aug 01 '26 00:08

mulllhausen


1 Answers

in your home directory cd ~ you have a soft link

hosts -> /c/Windows/System32/drivers/etc/hosts

which is not /etc/hosts (don't know why :)) so if you are admin on your computer use

nano ~/hosts        # not /etc/hosts
like image 170
bortunac Avatar answered Aug 05 '26 04:08

bortunac