- Step 1: Install package expect if not install on my computer.
- Step 2 : create file deploy_project.sh and paste code .
- Step 3 Open terminal cd to directory run command ./deploy_project.sh#!/usr/bin/expectset login "root" # user loginset addr "192.168.1.44" # ip serverset pw "123456" # password login sshspawn ssh $login@$addrexpect "$login@$addr\'s password:"send "$pw\r"expect "#"send "cd /var/www/html/project_example\r" # go to directory projectexpect "#"send "git pull\r" # command git pull source codeexpect "#"send "exit\r" # disconnect to serverinteract # close shell
Please have any questions.
Good Luck !