I'm writing "fake deployment" bash script I want to run to pull latest master on server. I have a following script:
#!/usr/bin/expect -f
spawn ssh -t user@host.domain 'cd path/to/dir'
expect "continue"
sleep 1
send "yes\r"
expect "assword:"
sleep 1
send "password\r"
# Commands for remote
git pull origin master
expect "sername"
sleep 1
send "username\r"
expect "assword"
sleep 1
send "password\r"
interact
Connection is made successfully, however, when the git pull origin master
is ran, the error is triggered: invalid command name "git"
.
I'm probably should run the commands differently, unfortunately, I'm not sure how. How will I be able to run the "Commands for remote" on remote? Thanks in advance.