diff --git a/CHANGELOG b/CHANGELOG
index 31feb115d1e8599c2b49aab7178c173c365044d9..2c98b092e1ba36acfc17b73b648bb13de83494ef 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -62,6 +62,7 @@ v 8.0.4
   - Fix "Assign All" button on Runner admin page
   - Fix search in Files
   - Add full project namespace to payload of system webhooks (Ricardo Band)
+  - Add rake tasks for git repository maintainance (Zeger-Jan van de Weg)
 
 v 8.0.3
   - Fix URL shown in Slack notifications
diff --git a/lib/tasks/gitlab/git.rake b/lib/tasks/gitlab/git.rake
new file mode 100644
index 0000000000000000000000000000000000000000..4fbf5a9393cf7504fe7f8ee4fbd37c6e73b602a3
--- /dev/null
+++ b/lib/tasks/gitlab/git.rake
@@ -0,0 +1,52 @@
+namespace :gitlab do
+  namespace :git do
+
+    desc "GitLab | Git | Repack"
+    task repack: :environment do
+      failures = perform_git_cmd('git repack -a --quiet', 'Git repack')
+      if failures.empty?
+        puts "Done".green
+      else
+        output_failures(failures)
+      end
+    end
+
+    desc "GitLab | Git | Run gits garbage collection on all repo's"
+    task gc: :environment do
+      failures = perform_git_cmd('git gc --auto --quiet', "Garbage Collection")
+      if failures.empty?
+        puts "Done".green
+      else
+        output_failures(failures)
+      end
+    end
+    
+    desc "GitLab | Git | Git prune all repo's"
+    task prune: :environment do
+      failures = perform_git_cmd('git prune', 'Git Prune')
+      if failures.empty?
+        puts "Done".green
+      else
+        output_failures(failures)
+      end
+    end
+
+    def perform_git_cmd(cmd, message)
+      puts "Starting #{message} on all repositories"
+
+      failures = []
+      all_repos.each do |r|
+        puts "Performing #{message} at #{r}"
+        failures << r unless system(*%w(#{cmd}), chdir: r)
+      end
+
+      failures
+    end
+
+    def output_failures(failures)
+      puts "The following repositories reported errors:".red
+      failures.each { |f| puts "- #{f}" }
+    end
+
+  end
+end
diff --git a/lib/tasks/gitlab/task_helpers.rake b/lib/tasks/gitlab/task_helpers.rake
index c95b6540ebc6e2ce4315f2a74b2d3d2cf050b383..77c41bf61cb60a2e60d8c393e8ef74cfd059255e 100644
--- a/lib/tasks/gitlab/task_helpers.rake
+++ b/lib/tasks/gitlab/task_helpers.rake
@@ -128,4 +128,8 @@ namespace :gitlab do
       false
     end
   end
+
+  def all_repos
+    Dir.glob(File.join(Gitlab.config.gitlab_shell.repos_path, '**/*\.git'))
+  end
 end