diff --git a/Dockerfile b/Dockerfile
index f955df566c2703e2932e2e840816aea02efbbccd..506294d9a4a10ce6460c5b4c6418164a9f9d5c20 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -26,7 +26,6 @@ RUN addgroup --gid 1000 discourse \
  && mkdir -p ./tmp/sockets \
  && git clone --branch v${DISCOURSE_VERSION} https://github.com/discourse/discourse.git \
  && chown -R discourse:discourse . \
- && git remote set-branches --add origin tests-passed \
  && curl --silent --location https://deb.nodesource.com/setup_8.x | bash - \
  && apt-get update && apt-get install -y --no-install-recommends \
       ${BUILD_DEPS} \
@@ -57,6 +56,7 @@ RUN addgroup --gid 1000 discourse \
  && make && make install \
  && rm -rf pngquant \
  && cd /home/discourse/discourse \
+ && git remote set-branches --add origin tests-passed \
  && sed -i 's/daemonize true/daemonize false/g' ./config/puma.rb \
  && bundle config build.nokogiri --use-system-libraries \
  && bundle install --deployment --without test --without development \