mac 下使用sshpass可以实现无密码自动部署
mac 下如果出现sshpass不存在的报错的话
用brew install sshpass 是不可行的,会出现警告报错
Warning: No available formula with the name "sshpass". Did you mean sshs?
We won't add sshpass because it makes it too easy for novice SSH users to
用下面的分步做法就可以实现安装
wget https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb
brew install sshpass.rb
之后在Makefile里
sshpass -p "密码" scp tmp/$(APPNAME)_tmp ubuntu@$(REMOTE):/data/www/goblog.com
sshpass -p "密码" ssh ubuntu@$(REMOTE) " sudo supervisorctl start $(APPNAME)"
即可实现自动部署
需要注意有些命令需要使用sudo才能执行,这个记得补充一下就好。
本作品采用《CC 协议》,转载必须注明作者和本文链接