error while trying to sudo apt-get update GPG, no sign repository [duplicate]

I didn't quite understand how to fix these stuff from other posts. Can someone help me?

W: GPG error: https://dl.winehq.org/wine-builds/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 818A435C5FCBF54A
E: The repository 'https://dl.winehq.org/wine-builds/ubuntu bionic InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Solution 1:

When you are getting a public key error, the key itself is the last 8 digits of the NO_PUBKEY.

To install it run the following line

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 5FCBF54A

Then rerun your

sudo apt update

Hope this helps!

Solution 2:

This is telling you that your repository for Wine is not using code signing and is refusing to update because it doesn't know how to verify the packages from that repository.

You can fix the problem by adding their code signing keys from winehq.org:

wget -nc https://dl.winehq.org/wine-builds/Release.key
sudo apt-key add Release.key
rm Release.key