4

The problem is simple: one person pushed some unnecessary (and possibly private) info to origin on Gitlab. I need to remove it.

I understand how to change history in git, and how to make it be just like I want it to be. So I actually cleaned the history and force pushed it to the origin.

But the problem is that there is a merge request for this branch which collects all pushed versions of this branch (including this unnecessary info). So I decided to remove this merge request. It is not such trivial task (it can't be done through GUI), but after some search I found that this can be done through Gitlab API like this: curl --request DELETE --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/4/merge_requests/85 (look https://docs.gitlab.com/ee/api/merge_requests.html#delete-a-merge-request).

After that I ran "Housekeeping" from Project Settings on Gitlab which should do garbage collecting, but repository size haven't changed. I checked and yes - bad commits are still reachable by https://gitlab.com/<PROJECT>/commit/<HASH>. So it seems there are other things which don't allow these commits to be removed.

What should I do to prevent possible private info leak and to shrink repository from origin's ~130MB to my local .git/ ~30 MB.

P.S. I know about hardcore solution with creating new project and importing old one to it - it is not what I want.

P.P.S. I use Gitlab-hosted server so I can't (or can I?) just open ssh console and remove some files / database entrances manually.

UPD. Through API I got list of origin commits (https://docs.gitlab.com/ee/api/commits.html#list-repository-commits). Bad commits were not in this list, so this list should be identical to my local commit list.

Dmitry
  • 111
  • 1
  • 10
  • 1
    Except the repository recreation, you can only run gc with forced expiration like in https://stackoverflow.com/q/27867775/2303202 . Don't know if it is possible to tweak those values for gitlab – max630 Jul 19 '17 at 13:13
  • @poke this is not a duplicate of the linked question – max630 Jul 19 '17 at 13:17
  • @max630 You’re right, my bad. – poke Jul 19 '17 at 13:18
  • @max630, I tried to do it. For now it seems to have no result, but maybe Gitlab hasn't completed garbage collection. – Dmitry Jul 19 '17 at 13:58

1 Answers1

1

OK. I already said about my previous attempts in question. Also I tried local gc and reset --hard HEAD^ & push -f tricks from this answer: https://stackoverflow.com/a/37253227/4034402

And some days after (I don't know actually when), my repo size became 37Mb! Though after going by direct link to the commit, I still was able to get all these purged files. So it is only partial solution, but I decided to post it here for anyone interested. Also, I don't know which steps were necessary for achieving this partial solution and which were not.

Dmitry
  • 111
  • 1
  • 10