Gitlab.com does not work with SSH key

Ok I found a solution, using these forum posts.

https://stackoverflow.com/questions/69910341/how-to-set-ssh-config-for-2-different-gitlab-accounts

I found that you need to create a “~/.ssh/config” file and fill it out with the gitlab info.
EG:

Host gitlab.com
  Hostname gitlab.com
  User git
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/<id_your_file_here>