When running apt-get update inside Ubuntu 18.04, I have the following error:

W: GPG error: https://developer.download.nvidia.cn/compute/cuda/repos/ubuntu1804/x86_64 InRelease: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY A4B469963BF863CC
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.

This is because Nvidia is changing their public keys for their repositories, see the details here. The instructions in the original post does not work for me. I still see errors after running the command. Since I am building a Docker image, I followed the instructions here and it works:

RUN rm /etc/apt/sources.list.d/cuda.list
RUN rm /etc/apt/sources.list.d/nvidia-ml.list
RUN apt-key del 7fa2af80

The two rm commands are crucial to fix the issue. The directory /etc/apt/sources.list.d/ stores the apt repository list for some packages, so that you do not need to touch the main source list file /etc/apt/sources.list. Files under this directory has the same format as the main sources.list file, and they are usually added by automated tools.
The command apt-key del 7fa2af80 will delete the old public key for Nvidia. The apt-key adv --fetch-keys commands is used to add the new public keys for Nvidia.