How can I use two bitbucket accounts (with separate ssh keys) on the same PC with TortoiseHg?

I have a BB (BitBucket) account for work and a BB account for myself and want to have access to them from one PC using TortoiseHg with SSH.

When you add two keys to Paint, and then try to click on a repo that uses one of the accounts, the first SSH will be transferred to BB, and if it uses the BB account SSH BB, it will register the user using the account The record associated with this SSH key.

Now, if this first SSH key is for an account that has repo access, which is great. BUT IF the first SSH key for another account receives an authorization error.

There seems to be no way to pass the correct BB key using TortoiseHg. And so I am constantly changing SSH from Projectant, which is clearly not perfect, and I could also abandon SSH and use passwords. :(

Does anyone know how to get TortoiseHg to send the correct SSH for this account?

+4
source share
1 answer

When I wrote this question, I had to deal with a solution! Now the reason I haven't come across this before was for Git not Mecurial, so I think it's worth posting this question and this solution anyway, to allow others in the same boat to easily find a solution. :)

The solution was from here: https://answers.atlassian.com/questions/150285/only-the-top-listed-private-key-in-pageant-is-used-offered-by-git-sourcetree-tortoisegit

Here is the important part:

One way to solve this problem is to perform the same configuration in PuTTY to eliminate which key to send (and therefore which user to authenticate as).

  • Launch PuTTY (download it from putty.org if you donโ€™t have one)
  • Type "bitbucket.org" in the host name field.
  • Go to Connection> SSH> Auth in the tree
  • Specify the key to be used for BB user
  • Return to the Session section in the tree
  • Enter an alias under "Saved Sessions" (for example, bb-user1) and save
  • Repeat 2-6 for each BB user and save as a different session name

Then, in your remote URL files, replace โ€œbitbucket.orgโ€ with a session (for example, bb-user1) to eliminate which SSH key to send first. This is identical to using IdentityFile in OpenSSH.

+6
source

Source: https://habr.com/ru/post/1480253/


All Articles