问题描述
我在具有动态DNS地址的计算机上有一个git存储库-它的IP地址每隔几天就会更改一次.
I am have a git repository on a machine with a dynamic DNS address - its IP address changes once every few days.
涉及与机器通信的每个git操作都会产生以下警告:
Every git operation that involves communicating with the machine yields the following warning:
我认为这是有关可能的MITM攻击的SSH警告.无论如何,有没有禁止所说的警告?
I assume this is SSH warning about a possible MITM attack. Is there anyway to suppress said warnings?
推荐答案
您是从网络内部还是外部进行呼叫?由于NAT协议的某些限制,前一种情况根本行不通.如果您在家",只需使用本地地址.您可以向存储库中添加多个远程服务器,因此对于fetch
,push
,您可以选择应该使用的远程服务器.
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.
例如
如果你在家
git remote add homenet 192.168.1.1:/foo/bar/repo.git
git push homenet master
如果您在外面某处
git remote add outside mynet.dyn.example.com:/foo/bar/repo.git
git push outside master
另一种解决方案是,如果将动态主机名添加到hostsfile中(应该在linux下为/etc/hosts
,不知道它在Windows下的位置),所以您的计算机将不再使用dns进行解析.
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
这篇关于在动态DNS后面使用git的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!