Question

I have added a new public key to log into my server.

git is attempting to use the same key for bitbucket, this fails and git cannot be used as its trying to use that public key.

Is there a config option for git to tell it to ignore the public key i have in place?

I have attempted to set up multiple ssh identities, by using this https://confluence.atlassian.com/pages/viewpage.action?pageId=271943168 but its failed and git still does not work.

Rather than set up a whole new key, I just want git to ignore the key altogether.

Edit

My current ssh config looks like this

ServerAliveInterval 15
ServerAliveCountMax 3

Host bitbucket
 HostName bitbucket.org
 IdentityFile ~/.ssh/bitbucket
Was it helpful?

Solution

I imagine the problem is the url to your repo. It needs to be adjusted to use the alias created in your ~/.ssh/config:

git remote set-url origin git@bitbucket:path/to/repo.git

Additionally, you could make your ~/.ssh/config look like this:

ServerAliveInterval 15
ServerAliveCountMax 3

Host bitbucket
 HostName bitbucket.org
 User git
 IdentityFile ~/.ssh/bitbucket

Note the presence of the User key. That will tell ssh that whenever you use the alias bitbucket to also use the user name git. The above command can then become:

git remote set-url origin bitbucket:path/to/repo.git

Additionally, whenever you clone, you can do:

git clone bitbucket:path/to/repo.git

To also save you a little typing.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top