Answer the question
In order to leave comments, you need to log in
How to use multiple keys of one server in git?
There is an already generated key (and added to the repository)
if the key name is changed to id_rsa (standard, but NOT created with that name), then git works like a clock, but if I change it to a different name (both public and private) in this case, id_rsa in general no and there is .ssh/config, in which:
Host host_h1
HostName bitbucket.org
PreferredAuthentications publickey
IdentityFile ~/.ssh/h1
Host host_h2
HostName bitbucket.org
User jobsearch
PreferredAuthentications publickey
IdentityFile ~/.ssh/h2
Answer the question
In order to leave comments, you need to log in
Bitbucket, as well as github, use a key to determine the username. Therefore, when SSH connects to these servers, the User is always the same - git. Those. you need to remove User jobsearch (or replace it with User git, and in the first case you can put User git).
Further, in order for ssh to choose different keys, when connecting, you need to specify not the name of the original host, but the name of the host alias (the one in Host). Those. git clone host_h2:/... and git clone host_h1:/...., well, or git clone [email protected]_h2:/... and git clone [email protected]_h1:/.... if User was removed from the config.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question