Accidentally deleted gitlab-secrets.json

I have a running gitlab-ce instance. While writing some scripts to backup /etc/gitlab like an idiot, I accidentally deleted that folder after copying it to a test backup directory. I deleted the test backup directory and went to get some coffee. I must have changed back into the live instance’s directory before leaving or something. When I can back I thought I had forgotten to delete the “test backup” before leaving and did rm -rf * on /etc/girlab. FACEPALM

I happened to have copied my gitlab.rb file so that is safe. Is there anyway to dump gitlab-secrets.json and the other ssh key files from the running instance? Everything seems to work fine. I’m hoping I can regenerate the files other than gitlab.rb from memory, or the other files in /var/opt/gitlab. Any ideas?

You will have to follow this:

since if you don’t have gitlab-secrets.json, then you will have to reset various things first (disable 2FA if users enabled it, reset CI/CD stuff, reset tokens, etc). You cannot recover it, when you make a backup you should be making a backup of this file as well.

1 Like

Is there no way to generate the secrets from a running gitlab instance? I never took gitlab down. It is running now, and I’m able to use it normally.

No it seems not, hence I sent you the link to reset it. There are posts on this forum where people had similar, and they also had to reset. You cannot generate it.

Please make sure you backup this file for the future!

That’s a shame! Thank you for your help!