A
A
Alexey2019-02-02 13:35:33
git
Alexey, 2019-02-02 13:35:33

Using multiple ssh keys for gitlab?

How to use multiple ssh keys for different projects and accounts on the same PC?
I have two gitlab accounts.
In the main account, I work with some projects.
I created an additional account for other projects.
Now I'm setting up ssh for the second account.
I generated ssh, added to gitlab account.
When trying to clone a project:

Enter passphrase for key '/Users/mac-pc/.ssh/id_rsa': 
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Note: knocking on this path: '/Users/mac-pc/.ssh/id_rsa'although it should be knocking on another file, let's say "id_rsa_second"
When trying
ssh -T [username]@gitlab.com   
[username]@gitlab.com: Permission denied (publickey).

All ssh keys are in the .ssh folder

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DevMan, 2019-02-02
@alexmirg

https://medium.freecodecamp.org/manage-multiple-gi...
this is for github, but the principle is the same.

B
Boris Syomov, 2019-02-02
@kotomyava

ssh -i /Users/mac-pc/.ssh/id_rsa_second -T [username]@gitlab.com
Or do the mapping in ~/.ssh/config if you don't want to manually do it every time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question