Is there any way to operate GitLab and GitHub accounts through SSH Key by using two different email address?
I Have two mail id, [email protected]
and [email protected]
and I want to push some projects to gitlab as well as some other projects to github and also I want to avoid password entering prompt in every push command. Is it possible?
You could try working with ssh instead of https: upload your public ssh git to the server, and use an ssh url. For instance, for github you shouldn't have a url like
https://github.com/<username>/<repo>.git
but you should have
[email protected]:<username>/<repo>.git
--
Now, to use different ssh keys or username, you could try setting your ~/.ssh/config
file to something like
Host gitlab.com
HostName gitlab.com
IdentityFile ~/.ssh/gitlab
User [email protected]
Host github.com
HostName github.com
IdentityFile ~/.ssh/github
User [email protected]
WhereIdentityFile
are the path to your private ssh keys
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With