diff --git a/CHANGELOG b/CHANGELOG
index 35ef11bb30c1645ecdbc1aa12ba1ee739b9dae91..e410d73d1f69174cb2a1af00ea23b96119fdfd8b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -135,6 +135,7 @@ v 8.12.0 (unreleased)
   - Return 204 instead of 404 for /ci/api/v1/builds/register.json if no builds are scheduled for a runner !6225
   - Fix Gitlab::Popen.popen thread-safety issue
   - Add specs to removing project (Katarzyna Kobierska Ula Budziszewska)
+  - Clean environment variables when running git hooks
 
 v 8.11.6
   - Fix unnecessary horizontal scroll area in pipeline visualizations. !6005
diff --git a/lib/gitlab/git/hook.rb b/lib/gitlab/git/hook.rb
index 9b681e636c7fcc68171e4624a4b2f49d7d64639c..bd90d24a2ecd333477cf96e530215a935f562f39 100644
--- a/lib/gitlab/git/hook.rb
+++ b/lib/gitlab/git/hook.rb
@@ -17,11 +17,13 @@ module Gitlab
       def trigger(gl_id, oldrev, newrev, ref)
         return [true, nil] unless exists?
 
-        case name
-        when "pre-receive", "post-receive"
-          call_receive_hook(gl_id, oldrev, newrev, ref)
-        when "update"
-          call_update_hook(gl_id, oldrev, newrev, ref)
+        Bundler.with_clean_env do
+          case name
+          when "pre-receive", "post-receive"
+            call_receive_hook(gl_id, oldrev, newrev, ref)
+          when "update"
+            call_update_hook(gl_id, oldrev, newrev, ref)
+          end
         end
       end