ssh: Could not resolve hostname ...
运行大神写的 .sh 脚本部署到docker报错bogon:hjCloud kang$ sh publish.sh# 此处省略 大概300字ssh: Could not resolve hostname svr1: nodename nor servname provided, or not knownssh: Could not resolve hostname svr1: nodename
·
运行大神写的 .sh 脚本部署到docker报错
bogon:hjCloud kang$ sh publish.sh
# 此处省略 大概300字
ssh: Could not resolve hostname svr1: nodename nor servname provided, or not known
ssh: Could not resolve hostname svr1: nodename nor servname provided, or not known
ssh: Could not resolve hostname svr1: nodename nor servname provided, or not known
ssh: Could not resolve hostname svr1: nodename nor servname provided, or not known
ssh: Could not resolve hostname svr1: nodename nor servname provided, or not known
是因为 svr1 你并没有设置host 别名, 所以ssh 找不到服务器的ip地址,
解决办法是在 ~/.ssh/config 里设置一下host别名
# 别名
Host svr1
# 别名对应的 服务器IP 地址
HostName 101.201.XX.XX
# 登录用户名
User root
# 固有配置
IdentitiesOnly yes
现在你可以直接在终端敲入下面代码, 直接登录
ssh svr1
更多推荐
已为社区贡献1条内容
所有评论(0)