diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb
index f869488d8d87178e29acafe4d1e96ff0a2f4226d..44d70e741b2500df892b820e5d38f3629227cfeb 100644
--- a/spec/support/test_env.rb
+++ b/spec/support/test_env.rb
@@ -85,7 +85,7 @@ module TestEnv
     end
 
     # We must copy bare repositories because we will push to them.
-    system(*%W(git clone -q --bare #{factory_repo_path} #{factory_repo_path_bare}))
+    system(git_env, *%W(git clone -q --bare #{factory_repo_path} #{factory_repo_path_bare}))
   end
 
   def copy_repo(project)
@@ -113,4 +113,10 @@ module TestEnv
   def factory_repo_name
     'gitlab-test'
   end
+
+  # Prevent developer git configurations from being persisted to test
+  # repositories
+  def git_env
+    {'GIT_TEMPLATE_DIR' => ''}
+  end
 end