我一直试图让gitHub和Egit合作,但没有成功。我安装了 github 的软件包并以这种方式制作了一个 SSH key ,但是 Egit 没有提示我输入密码,它给了我这个错误:
Cannot get remote repository refs.
Reason: ssh://git@github.com:22: passphrase for C:\Documents and Settings\User\.ssh\id_rsa
我在推送菜单中有这些设置:
URI: ssh://git@github.com/YoungMaker/<projectName>.git
host: github.com
Repository path: /YoungMaker/<projectName>.git
protocol: SSH
port <BLANK>
User: git
password <blank>
我也试过GIT_SSH环境变量,设置到C:\Documents and Settings\User.ssh,还有plink.exe(我不知道那是什么(明明是一些.exe))
尝试从 gitHub GUI 推送后,出现此错误。这很奇怪,因为我有 C:\Documents and Settings\User.ssh 目录,里面有一个配置文件和一个 id_rsa key 。
Pushing to git@github.com:YoungMaker/GitTester.git
error: cannot spawn C:\Documents and Settings\User\.ssh: No such file or directory
fatal: unable to fork
最佳答案
老问题,但供将来引用:
确保您设置了推送 Remote 。当我遇到 无法获取远程存储库引用 问题(“...密码短语...”和“推送...”对话框中的“Auth 失败”时,它对我有用)。
前提是你已经:
使用 Github 设置 SSH key (窗口 > 首选项 > 常规 > 网络连接 > SSH2)
设置您的本地存储库(您可以关注 this guide)
创建了一个 Github 存储库 ( same guide )
...这是您的操作方式:
- 转到 Git 存储库 View (窗口 > 显示 View > 其他 > Git 存储库)
- 展开您的 Repository 并右键单击 Remotes --> “Create Remote”
- “Remote Name”:origin,“Configure push”:勾选 --> 点击“OK”
- 点击“更改...”按钮
- 粘贴您的 git URI 并选择协议(protocol) ssh --> 单击“完成”
- 现在,单击“保存并推送”,现在您应该会收到密码提示 --> 在此处输入公钥密码(前提是您 DID(并且您应该) 为您的公钥设置一个密码) --> 单击“确定”
- 现在您应该会看到一个确认窗口,上面写着“Pushed to YourRepository - origin” --> 点击“OK”
- Push to upstream ,但这次使用“配置的远程存储库”作为您的目标 Git 存储库
- 去给自己泡杯应得的咖啡吧!
关于eclipse - Egit ssh 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10263287/