Large files introduced during Agit centralized reviews can persist in the remote repository even after a merge request is closed. Remove these files to reclaim storage and improve repository performance.
Background
-
You can create a centralized review from a source commit that contains large files.
-
When a merge request is not merged, these large files do not belong to any branch or tag. However, a special reference created for the review keeps the files reachable, which prevents
git gcfrom reclaiming the space. Closing the merge request and forcing garbage collection does not remove these files.
Procedure
-
Navigate to the merge request page that contains the large files. If the merge request is open, close it.
-
Find the special references for the merge request. You can find them in one of the following ways:
From the command-line output
› git pr Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Delta compression using up to 8 threads Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 5.50 MiB | 6.79 MiB/s, done. Total 4 (delta 0), reused 0 (delta 0), pack-reused 0 remote: +-----------------------------------------------------------------------+ remote: | Merge Request #1367177 was created or updated. | remote: | View merge request at URL: | remote: | https://codeup.aliyun.com/xxx/xxx/xxx/xxx/merge_request/1367177 | remote: +-----------------------------------------------------------------------+ To xxx.git * [new reference] master -> refs/merge-requests/1367177/headIn the command-line output, the reference after
->in the last line is the special reference for the merge request:refs/merge-requests/1367177/head.Merge request URL
In Alibaba Cloud Codeup, open the merge request details page for the repository and view the URL in your browser's address bar.
The number after
merge_request/in the URL is the review ID. If the review ID is 1367177, the special reference isrefs/merge-requests/1367177/head.Review staging reference
On the merge request details page, find the source commit ID in the source branch area (for example,
2a2d43d8).Click the source commit ID to go to the commit details page, and then copy the full commit ID.
In this example, the commit ID is
2a2d43d8daa87b28e71067d5d0681a23c3ba5105. The corresponding review staging reference isrefs/keep-around/2a2d43d8daa87b28e71067d5d0681a23c3ba5105. -
In your local repository, run the following commands to delete the special references from the remote repository:
cd your_local_repository git push origin :refs/merge-requests/1367177/head git push origin :refs/keep-around/2a2d43d8daa87b28e71067d5d0681a23c3ba5105 -
On the repository settings page, navigate to storage space management, click Clear, and set the cleanup policy to Immediately delete data.