1

I added a ssh alias to use a different key-pair for a certain domain. The key does not have a passphrase. I had followed the directions at https://confluence.atlassian.com/bitbucket/configure-multiple-ssh-identities-for-gitbash-mac-osx-linux-271943168.html and at the end added the ssh key with ssh-add.

I later rebooted and the key wasn't working any more - a git fetch from the console in the repo using the alias failed with a permission error. I looked at ssh-add -l and noticed that the key wasn't there anymore. I looked at ssh-add is not persistent between reboots to understand how to fix this - but it seemed from https://unix.stackexchange.com/a/140107/108129 that if I don't have a passphrase, I shouldn't need to.

Is there something I can do to not require to add the key to the ssh-agent - or an easy way to add it permanently?

Update: my .ssh/config is:

VisualHostKey=yes
Host myproject
  HostName bitbucket.org
  IdentityFile ~/.ssh/myproject
Host *
  User yehosef
  • What exactly did you set up? Good start is to know what the ssh-agent is and how does it work and why you can't add it permanently. – Jakuje Dec 14 '16 at 13:22
  • in my .ssh/config I set a host alias to use a certain IdentityFile for a certain domain. So in git instead of referring to the origin as git@bitbucket.com:<user>/<repo> I use git@<alias>:<user>/<repo> when go to the repo and do a (eg) git fetch, I have a permission issue. If I type ssh-add <other IdentityFile> then the git fetch works. I had understood from the link I included that if I don't have a passphrase, which I don't, I shouldn't need ssh-agent. Yet it seems I do. – Yehosef Dec 14 '16 at 14:10
  • Please, update the question with these details and the content of your .ssh/config. – Jakuje Dec 14 '16 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.