I noticed that on Bitbucket server side in "repository" catalog in some of repositories is "DELETED" file exist. It is means that repo was deleted?)
-
1It's not at all clear what you mean here. Provide some examples; see [ask]. – torek Oct 06 '21 at 22:59
-
for example that file exist in bare repo stored on server side filesystem -rw-r----- 1 dockeradm docker 20 Nov 9 2015 DELETED – Отправитель Скрыт Dec 06 '21 at 06:57
-
That sounds like you've stored a file named "DELETED". There's nothing at all unusual about that except the file's name. Naming a file DELETED is like naming your pet "nobody": "Come here nobody!" – torek Dec 06 '21 at 07:00
-
Please notice that is bare repo. And files not store in root of that repo folder. – Отправитель Скрыт Dec 06 '21 at 15:23
-
A bare repository is one without a work-tree. Where are you observing this file system file, and who extracted it and how? – torek Dec 07 '21 at 00:42
-
I'm not sure that understand you right. That is bare repository on Bitbucket server under
/data/repositories/ – Отправитель Скрыт Dec 07 '21 at 05:32folder -
I have no idea what you mean by "server side filesystem". It appears we are not talking to each other. – torek Dec 07 '21 at 07:18
-
i have a self hosted Bitbucket server. And i am talking about that side – Отправитель Скрыт Dec 07 '21 at 17:26
-
OK. So you log in to the server and run `ls -l` on some file. Why do you expect this file to be one that came out of Git? The repository *on* the server is a bare repository, that has no working tree. Running `git push` *to* that repository simply adds commits to the repository and/or updates branch names in it. Unless you have some sort of post-receive hook, no *files* are updated during this process. – torek Dec 07 '21 at 21:02
-
ls -l i run inside of one repository. and i found that file inside of that repo. so, related with that i have a question - what file is? and may be it is just a flag that sign "that repo was deleted" – Отправитель Скрыт Dec 08 '21 at 19:18
-
All I can tell you for sure is that *Git* did not make that file. You're running some additional non-Git software on the system. That software might or might not *use* Git, and that software made that file. You'll need to find out what it was that made that file in order to find out why it made that file (i.e., what its purpose was when it made that file). – torek Dec 08 '21 at 19:21
-
that software is Bitbucket. He manage that repo itself. And i am manage Bitbucket, but i no have idea what file is – Отправитель Скрыт Dec 10 '21 at 12:11
-
OK, so, why did you tag this with [tag:git] [tag:file] [tag:repository] [tag:bare], when the correct tag is clearly [tag:bitbucket]? – torek Dec 10 '21 at 22:29
-
thanks, i changed tags – Отправитель Скрыт Dec 12 '21 at 18:55
1 Answers
I noticed these DELETED files in our Bitbucket server filesystem too, so my team reached out to our contact at Bitbucket. Turns out that if you delete a repository that has been forked, removing it from the filesystem would break the forks because they wouldn't be able to reference the original commits. So instead, Bitbucket deletes the repo from the database but leaves it on the filesystem, adding this "DELETED" file to indicate that the repo has been deleted from the Bitbucket database.
Unfortunately, even if you delete all of the forks after that, Bitbucket has lost the reference to the original repo so it doesn't know to go back and clean the repo up. If you want to delete these unused repos, you would want to check the filesystem for any references to the deleted repo.
Our Bitbucket contact said this should do the trick:
$ cd /apps/stash-home/shared/data/repositories
$ find -name alternates -exec grep -iRl "repositories/12345" {} \;
where 12345 is the repository_id for the deleted repo.
If there are no references to repo 12345, you're safe to delete it. If there are, you should check whether those forks are in use anymore and clean them up if not.

- 16
- 2