Can no longer Push to repo after updating to 15.5.1 and migrating server to new host

Hello everyone. I can no longer push using an API key to my repository. I also created a new API key with read/write repo access to see if I corrupted the key somehow during the upgrade. The error I am getting is:

Enumerating objects: 23, done.
Counting objects: 100% (23/23), done.
Delta compression using up to 8 threads
Compressing objects: 100% (18/18), done.
Writing objects: 100% (18/18), 2.48 KiB | 1.24 MiB/s, done.
Total 18 (delta 13), reused 0 (delta 0), pack-reused 0
remote: GitLab: 401 Unauthorized
To [redacted]
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to '[redacted]'

I am not sure why it says I am unauthorized. I am the project owner (and run the gitlab server myself as it is a private instance just for my code). I looked at the pre-receive hood declined and I have no hooks anywhere. I checked the repo protection and even unprotected the main branch (still got the same error). Any help would be appreciated.

When you migrated to the new server, did you make sure to copy /etc/gitlab/gitlab-secrets.json as well?

Yes, I transferred the gitlab.rb and gitlab-secrets.json files.

EDIT:
To be safe, I just transferred it again and then did a gitlab-ctl reconfigure. Still getting the issue.

Seems strange. I’m using 15.5.2 and a personal access token to push with and just works. I’ve also had previously upgraded to 15.5.1 as well as all other previous versions (I generally upgrade as soon as the next point release is out). Is this a personal access token or project token?

It is a personal access token. It was working before the upgrade. I upgraded from 14.X so that I could backup the database and restore the database on a new server. I followed this article and just used the docker equivalents Migrating GitLab to Another Server | by Didiet Agus Pambudiono | GITS Apps Insight | Medium

FWIW, you might want to check the official docs: Back up and restore GitLab | GitLab

Definitely strange that a PAT would stop working though…

Edit: Although you said even a new key doesn’t work - the problem must be somewhere else then.

Thanks, not sure what I did but I backed up the server, the one I restored too. Deleted everything but the gitlab.rb and the secrets and then restored the database again and everything started working again like normal. Not sure why every thing is on the same server.