Working with git behind a dynamic DNS

2019-05-11 14:11发布

I am have a git repository on a machine with a dynamic DNS address - its IP address changes once every few days.

Every git operation that involves communicating with the machine yields the following warning:

reverse mapping checking getaddrinfo for 1-2-3-4.isp.net [1.2.3.4] failed - POSSIBLE BREAK-IN ATTEMPT!

I assume this is SSH warning about a possible MITM attack. Is there anyway to suppress said warnings?

标签: git ssh
1条回答
叼着烟拽天下
2楼-- · 2019-05-11 14:28

You call this from within your network, or from outside? The former case simply doesnt work, because of some restrictions of the NAT-protocol. Just use the local adress, if you are "at home". You can add multiple remotes to your repository, so for fetch, push and so one you can choose which remote it should use.

For example

If you are at home

git remote add homenet 192.168.1.1:/foo/bar/repo.git
git push homenet master

If you are somewhere outside

git remote add outside mynet.dyn.example.com:/foo/bar/repo.git
git push outside master

Another solution would be, if you add your dynamic hostname into your hostsfile (should be /etc/hosts under linux, dont know, where it resides under windows), so your machine will not using the dns for resolving anymore.

192.168.1.1 mynet.dyn.example.com
查看更多
登录 后发表回答