diff --git a/CHANGELOG b/CHANGELOG
index 5b0c856c051198bc36773b6e98dcb22f9a6e8403..cdeb5db43c75336bb733d6a384dd1f186f2e05a8 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+v 7.2.22 (unreleased)
+  - Don't include commit ID in archive of tag
+  - Don't include commit ID twice in archive of specific commit
+
 v 7.2.21
   - Add checks if blob is a lfs pointer, values for size and oid.
 
diff --git a/lib/gitlab_git/repository.rb b/lib/gitlab_git/repository.rb
index 1d81a7c1c1b133ffdeffc59820dbdda7bb17524b..0d6b2b721795bde42b958eff293b3be325e55f7e 100644
--- a/lib/gitlab_git/repository.rb
+++ b/lib/gitlab_git/repository.rb
@@ -144,7 +144,14 @@ module Gitlab
         return {} if commit.nil?
 
         project_name = self.name.chomp('.git')
-        prefix = "#{project_name}-#{ref}-#{commit.id}"
+        prefix =
+          if tag_names.include?(ref)
+            "#{project_name}-#{ref}"
+          elsif branch_names.include?(ref)
+            "#{project_name}-#{ref}-#{commit.id}"
+          else
+            "#{project_name}-#{commit.id}"
+          end
 
         {
           'RepoPath' => path,