Remote: GitLab: 401 Unauthorized To xxxx:sources/code.git

I installed a neue Server "Ubuntu 20.04 and Gitlab 14.0.5 - i restored the latest Gitlab Backup and the people can work on the GUI - the first impression is - it’s works. But the developer have no access to the repositories. I check the Gitlab Installation “gitlab-ctl reconfigure, gitlab-rake gitlab:check,gitlab-rake gitlab:check SANITIZE=true” and i don’t see any problem.
I get following message " remote: GitLab: 401 Unauthorized To xxxx:sources/code.git ! [remote rejected] bse_coords → bse_coords (pre-receive hook declined) error: failed to push some refs to ‘git@git.xxx:sources/code.git’
We tried to do a check-in and clone in the GUI, but without success . What is wrong and how can I solve the problem? Thanks


The problem only appears during the “push” process.
I found an article “You need to sync your gitlab-secrets.json file with your GitLab application nodes.” And how do I do that?

the problem is solved, configuration in sshd_confg were the problem

We are using 13.12.12-ee.
Facing the same issue.
Kindly share fix you have done on sshd_config

Thanks in advance,
Herbert.

We found the solution for our issue.
Here is our what we tried.

Issue:
We are using omnibus installation.
We were getting “401 error” after we restore the backup from the source machine.
As per the documentation synced the gitlab-secrets.json file source machine to destination.
After that we were were not able to push anything.

Solution:
Take a backup of /etc/gitlab/gitlab-secrets.json in the destination machine.
Copy the /etc/gitlab/gitlab-secrets.json from source machine to destination machine
Take the value of “gitlab_shell” - “secret_token” from the destination machine’s backup of gitlab-secrets.json file, and replace in the value in /etc/gitlab/gitlab-secrets.json (which was copied in destination from the source machine).
run gitlab-ctl reconfigure

1 Like

That was the case for me as well. The problem was fixed, but I do not like the idea to have the same key for both gitlab instanses. Is there a way to regenerate new gilab-shell key?