bitbucket, ssh key can't have name other than id_rsa

if my key is named and I put it into bitbucket ssh setting. It is working out of box. When I ssk-keygen name like, then insert to ssh key setting. It is saying

I try this in ~/.ssh/config

Host andatech_bitbucket_my_username
  User andatech_my_username
  IdentityFile ~/.ssh/andatech_my_username_bitbucket


I got this error:

repository access denied.
fatal: Could not read from remote repository.

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

 More detail:

1 answer

0 vote

Are the remotes on your repos listed as "andatech_bitbucket_my_username" or as ""? If the first part of the URL isn't "andatech_bitbucket_my_username", then SSH won't refer to that stanza in your config, and as a result it won't use the key you want.

You can fix this in one of two ways:

1. If you want to make all SSH connections to Bitbucket use that key and username, then change your .ssh/config to have "Host" instead of what you've listed here.

2. If you want certain repos to use that key, but other connections to Bitbucket to use something else, then go to those repos and run this:

git remote set-url origin andatech_bitbucket_my_username:owner/repo.git

(changing "owner" and "repo" appropriately)

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

26,568 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you