ROS2インストールでThe following signatures couldn't be verified because the public key is not available出たとき対処法

ROS2インストール作業をしていたら、途中でThe following signatures couldn't be verified because the public key is not available出ました。その時の対処法メモ

Kauzmichi Shirai

ROS2のインストールをしていたら、次のようなエラーが出ました。

Err:1 http://packages.ros.org/ros2/ubuntu bionic InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F42ED6FBAB17C654 

aptの公開鍵を登録するのが抜けてました。
次のコマンドを入力することで解決しました。

$ curl http://repo.ros2.org/repos.key | sudo apt-key add -