diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b54c49b1d973a9d9b875c1643e79a952fff3041e..03536135aafe6150ac85cbafbe32cc18f4df57a8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -117,6 +117,7 @@ deploy_zenodo:
     - build_docker
   before_script:
     - apt update && apt-get install git -y
+    - git clean -f
     - pip install .
     - python eossr/scripts/update_codemeta_eossr.py -c codemeta.json
     - eossr-check-connection-zenodo --token $ZENODO_TOKEN -p $CI_PROJECT_DIR
diff --git a/examples/CI_code_snippets/3.ex_CI_upload_ossr.md b/examples/CI_code_snippets/3.ex_CI_upload_ossr.md
index 547372ab9d43ba16d3d009469ffc4402289f4253..072746a3960bb5d80603ecefbb84051368cdade5 100644
--- a/examples/CI_code_snippets/3.ex_CI_upload_ossr.md
+++ b/examples/CI_code_snippets/3.ex_CI_upload_ossr.md
@@ -43,7 +43,6 @@ deploy_zenodo:
 
 ```
 
-
 ### Upload to Sandbox Zenodo
 ```yaml
 stages:
@@ -59,3 +58,11 @@ deploy_zenodo:
   only:
     - tags
 ```
+
+Note: you might want to restore the directory to its tag stage if you made changes in previous CI stages
+(for example removing build subdirs from previous test stages).
+You may do so using adding the following in the `before_script` section:
+```
+- apt-get install git -y
+- git reset --hard HEAD && git clean -fd
+```