Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can EGit (Eclipse git plugin) use an SSH key instead of a username and password?

Tags:

git

eclipse

egit

The git central repository to which I need to commit is configured using SSH keys. My username is jmglov, but when I perform git operations (e.g. git clone), I use this configuration:

: jmglov@kitiara; cat .git/config 
[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = [email protected]:AwesomeWare

When I try to use EGit in Eclipse to push to the origin, I'm prompted for a password for the git user, for which only SSH keypair authentication is enabled. My public key is one of the authorised keys for the git user.

Is it possible to configure EGit to use my SSH key instead of the git user's credentials?

like image 695
Josh Glover Avatar asked May 09 '11 10:05

Josh Glover


People also ask

How do I tell Git to use SSH key?

You would need to add a new host entry to your SSH config that uses the desired private key. If the SSH config file ~/. ssh/config does not exist, simply create it and add the host info. You then clone the repository by replacing the repo url domain with the host defined in the SSH config.


1 Answers

Yes, the configuration is picked up from the Eclipse preferences, as noted in the EGit user guide

SSH preferences

like image 148
Robert Munteanu Avatar answered Oct 14 '22 11:10

Robert Munteanu