title: Connect to remote via ssh and run git commands with expect
body: <p>I'm writing "fake deployment" bash script I want to run to pull latest master on server. I have a following script: </p>
  
  <pre><code>#!/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
  </code></pre>
  
  <p>Connection is made successfully, however, when the <code>git pull origin master</code> is ran, the error is triggered: <code>invalid command name "git"</code>. </p>
  
  <p>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.</p>