How to use multiple Git SSH keys on Eclipse? -


i looked several answers , forums solution not find single 1 works.

i have scenario:

  • eclipse luna service release 2 (4.4.2)
  • ubuntu 14.04 x64
  • two ssh keys on ~/.ssh folder
  • two bitbucket accounts (one personal projects , 1 enterprise)
  • a git repository accessible primary key (~/.ssh/id_rsa)
  • a git repository accessible secondary key (~/.ssh/other)

i created ~/.ssh/config file contents:

host bitbucket bitbucket.org     hostname bitbucket.org     identityfile ~/.ssh/id_rsa     identityfile ~/.ssh/other     user git 

and sake of sanity added second key using ssh-add well. running ssh-add -l lists both keys.

when using command line, git commands work charm, both repositories. when using eclipse, invalid remote: origin error when trying clone or pull repository secondary key:

caused by: org.eclipse.jgit.errors.noremoterepositoryexception: git@bitbucket.org:myuser/myrepository.git: conq: repository access denied. 

i added secondary key @ window > preferences > network connections > ssh2 > private keys, , set git_ssh environment variable point ssh executable:

$echo $git_ssh /usr/bin/ssh 

i've restarted eclipse , os several times, no luck.

since can use git command line without problems, tend believe there's wrong eclipse.

how use multiple git ssh keys on eclipse? or how force eclipse use secondary key on single project?

host bitbucket bitbucket.org? don't declare multiple entry names on 1 host section.

i expect see in ssh config file declaring multiple keys:

host bitbucketusera     hostname bitbucket.org     identityfile ~/.ssh/id_rsa     user git  host bitbucketuserb     hostname bitbucket.org     identityfile ~/.ssh/other     user git 

and use ssh url

bitbucketusera:usera/myrepo1 bitbucketuserb:userb/myrepo2 

(this similar suggested "how work on personal github repo office computer ssh key added work related github account?")


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -