EGit(Eclipse git 插件)可以使用 SSH 密钥而不是用户名和密码吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5935378/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 10:52:32  来源:igfitidea点击:

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

eclipsegitegit

提问by Josh Glover

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:

我需要提交的 git 中央存储库是使用 SSH 密钥配置的。我的用户名是jmglov,但是当我执行 git 操作(例如git clone)时,我使用以下配置:

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

When I try to use EGitin Eclipseto push to the origin, I'm prompted for a password for the gituser, for which only SSH keypair authentication is enabled. My public key is one of the authorised keys for the gituser.

当我尝试在Eclipse 中使用EGit推送到源时,系统提示我输入用户密码,仅启用了 SSH 密钥对身份验证。我的公钥是用户的授权密钥之一。gitgit

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

是否可以将 EGit 配置为使用我的 SSH 密钥而不是git用户的凭据?

回答by Robert Munteanu

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

是的,配置是从 Eclipse 首选项中提取的,如EGit 用户指南中所述

SSH preferences

SSH 首选项