The way - in my experience - is to use SSH keys. GPG keys should work similarly but I have not used them.
I have generated them once (using GitHub, but could be any other tool). Then uploaded them to all my other accounts (GitHub, GitLab, etc).
They must reside at
~/.ssh. Then the permissions must be set:
$ sudo chmod 600 ~/.ssh/id_rsa $ sudo chmod 600 ~/.ssh/id_rsa.pub