While poking around in one of our repos I noticed that we have a branch with a 40 character hexadecimal name, it’s 2 years old and has already been merged to master. When I tried to set-up push mirroring of the repo it complains about that specific branch.
remote: error: GH002: Sorry, branch or tag names consisting of 40 hex characters are not allowed. remote: error: Invalid branch or tag name "02e082d45646488afda6166c4d99d61611a2aab3"
So, I get it. There’s even a bug report for this type of problem at HackerOne that was awarded a bounty payout. So, there’s a GitLab pre-recieve hook that blocks these branches now. Which, thats great.
However, I can’t even delete this branch on the repository. When I try to use the UI to delete the branch, I get an error saying You cannot create a branch with a 40-character hexadecimal branch name.
.
I’ve tried through the API as well:
curl --request DELETE --header "PRIVATE-TOKEN: <mytoken> "https://gitlab.com/api/v4/projects/<project>/repository/branches/02e082d45646488afda6166c4d99d61611a2aab3"
{"message":"You cannot create a branch with a 40-character hexadecimal branch name."}
How can I nuke this branch?