I had to manually remove the folder node_modules/.cache/gh-pages to get the deployment to work.
Prior to this I had tried git fetch --prune, which removed remotes/origin/gh-page. I don’t know if pruning the branches was a necessary step or not.