Monday, September 2, 2019

How to use git to connect to Github and Gitlab on the same machine

Well, easy problem to solve.

Just edit/create the SSH config file ~/.ssh/config and add the two providers

Host github
HostName github.com 
IdentityFile ~/.ssh/github

Host gitlab
HostName gilab.com 
IdentityFile ~/.ssh/gitlab
changing/defining your SSH keys for each provider.

Go to Github config area and Gitlab config area and add your PUBLIC key (normally something like id_rsa.pub) to the list of keys.

That's all, now you can work with both platforms.


No comments:

Post a Comment