GitLab更新失败(Ubuntu)

时间:2024-03-27 11:10:51

在Ubuntu下使用apt更新gitlab报错如下:

An error occurred during the signature verification.The repository is not updated and the previous index files will be used.GPG error: ...
Failed to fetch https://packages.gitlab.com/gitlab/gitlab-ee/ubuntu/dists/focal/InRelese ...

编辑如下代码并运行:

awk '/deb \[signed-by=/{
       pubkey = $2;
       sub(/\[signed-by=/, "", pubkey);
       sub(/\]$/, "", pubkey);
       print pubkey
     }' /etc/apt/sources.list.d/gitlab_gitlab-?e.list | \
   while read line; do
     curl -s "https://packages.gitlab.com/gpg.key" | gpg --dearmor > $line
   done

运行成功后,再执行apt upgrade升级gitlab,恢复正常。