Running multiple ssh commands

is there a way to run each command once the previous has completed?

That's literally how it already works.

If you had been using & as the separator, that would allow commands to run simultaneously, but the ; separator always waits for the previous command to exit.

I can run the same command multiple times and get a different amount and order of errors.

The problem is that you're missing half of your command. Specifically, this part:

mv examplegit/* mv examplegit/.* .;

should probably be:

mv examplegit/* .; mv examplegit/.* .;

Because the 'mv' fails halfway and leaves a non-empty directory, it makes sense that the following 'rmdir' fails and a subsequent 'git clone' also refuses to clone into that non-empty directory.

Overall, you should also consider replacing all ; with && (two &'s) which additionally checks the exit code of the previous command, and will stop if the previous command failed.

ssh <user>@<host> 'cd /<dir>/example.com &&
    git clone https://<user>:<password>@bitbucket.org/<bucket>/examplegit.git -b develop &&
    mv examplegit/* . &&
    mv examplegit/.* . &&
    rmdir examplegit'

And, consider switching entirely to a different git deployment method that doesn't involve making a fresh clone.

(Your current method also leaves the entire Git repository accessible to all your visitors – they probably can just git clone https://example.com/.git and download all of your private source code.)

For example:

  1. Clone your repo to ~/git/example.com once

  2. To deploy, run:

    ssh user@host 'cd ~/git/example.com &&
                   git pull --ff-only &&
                   GIT_WORK_TREE=/<dir>/example.com git checkout -f'
    

The methods in the linked article will also take care of renamed/deleted files, while yours will keep old files forever.