git 从 Eclipse 推送到 github 存储库的问题:身份验证失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4614370/
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
Problems with pushing to github repository from Eclipse: Auth fail
提问by Derk
I followed the steps from Egit user guide, but I get an error message with auth fail.
我按照Egit 用户指南中的步骤操作,但收到一条错误消息,显示身份验证失败。
What I do:
I have copied the public key from Window > Preferences > Network Connections > SSH2 > Key Management
to GitHub under account settings
我的工作:
我已Window > Preferences > Network Connections > SSH2 > Key Management
在帐户设置下将公钥从GitHub复制到
Then I doTeam > Push
...
I enter the [email protected]:....
uri and click next. But then I get the error:
然后我做Team > Push
...
我输入[email protected]:....
uri 并单击下一步。但后来我得到了错误:
**Cannot get remote repository refs
Reason: [email protected]:.... : Auth fail**
What could be the problem?
可能是什么问题呢?
Thanks
谢谢
回答by Roger
Old question, but for future reference:
老问题,但供将来参考:
Make sure you did setup a push remote. It worked for me when I got both the Cannot get remote repository refs-problems ("... Passphrase for..." and "Auth fail" in the "Push..." dialog).
确保您确实设置了推送遥控器。当我同时遇到无法获取远程存储库 refs-problems(“... Passphrase for...”和“Push...”对话框中的“Auth fail”)时,它对我有用。
Provided that you already:
前提是你已经:
Setup your SSH keys with Github (Window > Preferences > General > Network Connections > SSH2)
Setup your local repository (you can follow this guidefor that)
Created a Github repository (same guide)
使用 Github 设置 SSH 密钥(Window > Preferences > General > Network Connections > SSH2)
设置您的本地存储库(您可以按照本指南进行操作)
创建了一个 Github 存储库(相同的指南)
... here's how you do it:
...这是你如何做到的:
- Go to the Git Repositories view(Window > Show View > Other > Git Repositories)
- Expand your Repository and right click Remotes--> "Create Remote"
- "Remote Name": origin, "Configure push": checked --> click "OK"
- Click the "Change..."button
- Paste your git URIand select protocol ssh--> click "Finish"
- Now, click "Save and Push"and NOW you should get a password prompt --> enter the public key passphrasehere (provided that you DID (and you should) setup a passphrase to your public key) --> click "OK"
- Now you should get a confirmation window saying "Pushed to YourRepository- origin" --> click "OK"
- Push to upstream, but this time use "Configured remote repository"as your Destination Git repository
- Go get yourself a well earned cup of coffee!
- 转到Git 存储库视图(窗口 > 显示视图 > 其他 > Git 存储库)
- 展开您的存储库并右键单击 Remotes--> “Create Remote”
- “远程名称”:来源,“配置推送”:选中 -->单击“确定”
- 单击“更改...”按钮
- 粘贴您的 git URI并选择协议ssh-->单击“完成”
- 现在,单击“保存并推送”,现在您应该会收到密码提示 -->在此处输入公钥密码(前提是您确实(并且应该)为您的公钥设置了密码)-->单击“确定”
- 现在您应该会看到一个确认窗口,上面写着“已推送到您的存储库- 来源”-->单击“确定”
- 推送到 upstream,但这次使用“配置的远程存储库”作为您的目标 Git 存储库
- 去给自己买一杯好喝的咖啡吧!
回答by Akseli Palén
Check my solution from this related question: "Auth Failed" error with EGit and GitHub
从这个相关问题中检查我的解决方案: EGit 和 GitHub 的“身份验证失败”错误
Briefly: set GIT_SSH environment variable with a path to the system ssh executable before launching Eclipse. Far from nice but works.
简而言之:在启动 Eclipse 之前,使用系统 ssh 可执行文件的路径设置 GIT_SSH 环境变量。远非很好,但有效。
For Ubuntu:
对于 Ubuntu:
> export GIT_SSH=/usr/bin/ssh
> eclipse
回答by decoder
DO not forget to add .git to the repository name in the URI : field
不要忘记将 .git 添加到 URI 中的存储库名称:字段
for example if ur username is Decoderx and git repository name is foo URI :https://github.com/Decoderx/foo.git
例如,如果您的用户名是 Decoderx 并且 git 存储库名称是 foo URI:https: //github.com/Decoderx/foo.git
and not "https://github.com/Decoderx/foo"this solved this problem for me.
而不是“ https://github.com/Decoderx/foo”,这为我解决了这个问题。
回答by Melissa Rice
I finally fixed this on my platform (mainly was a key issue but also critical not to have a leading slash before the repo path in the dialog pictured above). You can see more details in my post here, if you like:
我终于在我的平台上解决了这个问题(主要是一个关键问题,但在上图中的对话框中的 repo 路径之前没有前导斜线也很关键)。如果您愿意,可以在我的帖子中查看更多详细信息:
Good luck!
祝你好运!
Melissa
梅丽莎
回答by VonC
You can try and follow this tutorial, using the git+sshprotocol:
您可以尝试按照本教程使用git+ssh协议进行操作:
git+ssh://[email protected]/path_to/repo.git.github
Just [email protected]
alone wouldn't work.
光[email protected]
一个人是行不通的。