Reputation: 53616
I just inherited a laptop with a project hosted on Atlassian, etc. I have setup Git, and my Bitbucket profile. Yet, when I perform
ssh -T git@bitbucket
the connection is made using the previous guy's user name. I have
id_rsa
etc.) do not reference this user nameI do not know why SSH connects to Bitbucket with this user. Any help would be appreciated.
Upvotes: 2
Views: 3747
Reputation: 53616
Bitbucket handles public keys globally, meaning that no two users may register the same SSH key. Therefore, when I tried to connect, Bitbucket assumed the previous user since the key that it found was still attached to the user account of my predecessor.
Generating a new SSH key, overriding the previous one, then adding the public key to my Bitbucket account solved it.
Now, ssh -T [email protected]
resolves with my user name.
I also use a configuration file to manage my hosts
Host project1.bitbucket
HostName bitbucket.org
IdentityFile path/to/pub_key_a
Host project2.bitbucket
HostName bitbucket.org
IdentityFile path/to/pub_key_b
Then setup Git remote as
[remote "origin"]
url = [email protected]:orgname/project1.git
fetch = +refs/heads/*:refs/remotes/origin/*
(Change project1
with the repository name, and orgname
with the owner's name of the repository, etc.)
This is how to use different SSH keys with different Git repositories, etc.
Upvotes: 3