Ubuntu: The following signatures couldn’t be verified because the public key is not available

While running sudo apt-get update command if you are getting the error like this:

The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A6A19B38D3D831EF
Reading package lists... Done

The solution is to get the key for the key present after NO_PUBKEY text in the error.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys A6A19B38D3D831EF

In the above case, they key is A6A19B38D3D831EF.

After running the above command the sudo apt-get update will run without any errors.