I think we are missing a git pull there after the cd before the rebuild.
git pull
cd
If you do that, does that fix it?