GitHub and GitLab account on one computer?

cr
3

I have to set up a GitLab account on my computer in addition to my GitHub account.

I already linked my Git to my GitHub and GitLab via ssh. Now I've read this through and got it to work on my laptop. https://www.freecodecamp.org/news/manage-multiple-github-accounts-the-ssh-way-2dadc30ccaca/

3 things annoy me now

I have to activate the correct ssh key
i need to create a local gitconfig file
I always have to enter a pass key pharse before a commit

I would like to configure the whole thing so that git recognizes which configs and which ssh key should be used based on the remote repo. Is this even possible?

Hu

Why the effort? You can use the same key for different servers.

cr

Yes well but then I still have to create a local gitconfig file right?

Hu

Only if you want to appear in the commit log under different identities (email address or name). The key is sufficient for authentication and you can use it as often as you like.