之前用makefile调用sshpass去使用rsync去同步,后来换了服务器,然后更新IP和密码,再去执行,结果出错:Host key verification failed
参考自己之前的:
【已解决】rsync同步上传出错:Host key verification failed
去用ssh命令行登录,输入了正确的密码,也登录进去了。
但是后来再去试试,又出现另外的错误
➜ ucowsapp_h5 git:(master) ✗ make deploy
<span style="font-size: 12px; color: rgb(51, 51, 51); font-family: Monaco;"–<——————————————————————————
Author : crifan
Version : 20171222
Function: Auto deploy build files to remote server
Run ‘make help’ to see usage
<span style="font-size: 12px; color: rgb(51, 51, 51); font-family: Monaco;"–<——————————————————————————
rm -rf /Users/crifan/dev/dev_root//sourcecode/ucowsapp/ucowsapp_h5/ucowsapp_h5/uapp
mkdir -p /Users/crifan/dev/dev_root//sourcecode/ucowsapp/ucowsapp_h5/ucowsapp_h5/uapp
cp -a /Users/crifan/dev/dev_root//sourcecode/ucowsapp/ucowsapp_h5/ucowsapp_h5/build/* /Users/crifan/dev/dev_root//sourcecode/ucowsapp/ucowsapp_h5/ucowsapp_h5/uapp
sshpass -f sshpass_password.txt rsync -avzh –progress –stats –delete –force /Users/crifan/dev/dev_root//sourcecode/ucowsapp/ucowsapp_h5/ucowsapp_h5/uapp [email protected]:/opt/cowfarm/farm_web
bash: rsync: 未找到命令
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-52/rsync/io.c(453) [sender=2.6.9]
make: *** [clean_copy_deploy] Error 12
去看了看,命令都可以找到啊:
➜ ucowsapp_h5 git:(master) ✗ which rsync
/usr/bin/rsync
➜ ucowsapp_h5 git:(master) ✗ which sshpass
/usr/local/bin/sshpass
猜测可能是由于刚才用ssh登录远程服务器,退出后,环境受影响,所以找不到rsync?
重启iTerm终端试试,问题依旧。
换个终端,问题依旧:
把rsync换成:
/usr/bin/rsync
试试
sshpass -f $(PASSWORD_FILE) /usr/bin/rsync -avzh –progress –stats –delete –force $(TMP_PATH) $(REMOTE_USER)@$(REMOTE_SERVER):$(REMOTE_PATH)
结果:问题依旧,还是会出现:bash: rsync: 未找到命令
所以感觉有其他诡异问题?
先去解决:
【已解决】Mac中已安装rsync却报错:bash: rsync: 未找到命令
然后也就解决了此处问题了。
【总结】
此处rsync报错:
rsync: connection unexpectedly closed
的原因是:
需要远程服务器中也安装rsync,才能本地的rsync才能正常使用。
转载请注明:在路上 » 【已解决】Mac中rsync出错:rsync: connection unexpectedly closed