Git repo Access not working with access keys

Viewed 67
  1. I've generated ssh keys for user "devuser" using ssh-keygen command
  2. after the private and public keys are generated, I've added the public key to the project's Access Keys list in bitbucket
  3. when i try cloning the repo from bitbucket i get the below error
git clone ssh://git@host.fqdn.net:6999/dev-project/test-repo.git
Cloning into 'test-repo'...
ssh: Could not resolve hostname /home/devuser/.ssh2/id_rsa_2048_b: Name or service not known
fatal: Could not read from remote repository.

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

When i try the same the same steps for a different user on the same host, works fine for me. Appreciate any pointers

1 Answers

To add to larsks' comment, try:

GIT_SSH_COMMAND='ssh -F /dev/null' git clone ssh://git@host.fqdn.net:6999/dev-project/test-repo.git

Or

GIT_SSH_COMMAND='ssh -F /dev/null -i /home/devuser/.ssh2/id_rsa_2048_b' \
git clone ssh://git@host.fqdn.net:6999/dev-project/test-repo.git

That will force SSH to ignore your ~/.ssh/config.

  • If this works, then have a look at said config file.
  • If not, then, as noted, have a look at ssh -vT git@host.fqdn.net:6999 to understand what local files are considered by SSH during its interaction with the remote site.
Related