将代码从 Eclipse 提交到 Git 存储库时无法连接到任何 URI 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30421875/
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-09 05:32:22  来源:igfitidea点击:

Can't connect to any URI error while commiting code from Eclipse to Git Repository

eclipsegithub

提问by OsamaA

Facing this error while committing code from Eclipse to Github

将代码从 Eclipse 提交到 Github 时遇到此错误

Hi,

你好,

I am facing the issue 'Can't connect to any URI:....' while committing code to Github from Eclipse. I have also generated SSH keys for my machine and added to the Github account. Please help me out...

我在从 Eclipse 向 Github 提交代码时遇到了“无法连接到任何 URI:....”的问题。我还为我的机器生成了 SSH 密钥并添加到 Github 帐户。请帮帮我...

Thanks!

谢谢!

回答by Bahadir Tasdemir

I faced the same issue while migrating my project from github to bitbucket and this is how I resolved it:

我在将我的项目从 github 迁移到 bitbucket 时遇到了同样的问题,这是我解决的方法:

Introduction: I will describe the ssh key usage here. A user generates a unique key to connect to remote machines using ssh. So you can create it locally. After, user uploads the keys to the remote machines where want to connect without password and more securely. On Git, the same thing happens, user creates a ssh key and uploads the generated key value to the git system providers like Github or Birbucket. After uploading your unique key, you must configure your development environment to let your git system provider communicate providing security over ssh key.

介绍:我将在这里描述 ssh 密钥的用法。用户生成一个唯一的密钥以使用 ssh 连接到远程机器。所以你可以在本地创建它。之后,用户将密钥上传到想要无需密码且更安全地连接的远程机器。在 Git 上,同样的事情发生,用户创建一个 ssh 密钥并将生成的密钥值上传到 git 系统提供商,如 Github 或 Birbucket。上传您的唯一密钥后,您必须配置您的开发环境,让您的 git 系统提供商通过 ssh 密钥提供安全性进行通信。

1) I was using ssh key to push my commits to remote with github in eclipse, the ssh key is set at window -> preferences -> General -> Network Connections -> SSH2for eclipse (on git pushes, this ssh key is used if set). If you do not have any ssh keys on your machine then follow this articleto generate one for you and set it into eclipse at the path above.

1) 我在 eclipse 中使用 ssh 密钥通过 github 将我的提交推送到远程,ssh 密钥设置window -> preferences -> General -> Network Connections -> SSH2为 eclipse (在 git pushes 上,如果设置,则使用此 ssh 密钥)。如果您的机器上没有任何 ssh 密钥,请按照本文为您生成一个并在上面的路径中将其设置为 eclipse。

2) In your github or bitbucke account, find the screen where you can save your ssh key. For bitbucket, it is at https://bitbucket.org/account/user/[user-name]/ssh-keys/. '[user-name]' here is your user name at bitbucket. Open your 'id_dsa.pub' file (where you generated your ssh key) with a text editor, select all, copy and paste into your github/bitbucket accounts' ssh key addition section and then click add.

2) 在您的 github 或 bitbucke 帐户中,找到可以保存 ssh 密钥的屏幕。对于 bitbucket,它位于https://bitbucket.org/account/user/[user-name]/ssh-keys/。'[user-name]' 这里是你在 bitbucket 的用户名。使用文本编辑器打开“id_dsa.pub”文件(在其中生成 ssh 密钥),全选,复制并粘贴到您的 github/bitbucket 帐户的 ssh 密钥添加部分,然后单击添加。

3) At eclipse, be sure to use the 'ssh' GIT URI for your project. Go to Window -> Preferences -> Team -> Git -> Configuration, click 'Repository Settings' tab and paste your GIT ssh URI to remote.origin.url.

3) 在 eclipse 中,确保为您的项目使用“ssh”GIT URI。转到Window -> Preferences -> Team -> Git -> Configuration,单击“ Repository Settings”选项卡并将您的 GIT ssh URI 粘贴到remote.origin.url.

Bitbucket ssh uri selection

Bitbucket ssh uri 选择

4) Finally try to push your commits to remote. You mustn't face any errors, if you have please comment under my answer.

4)最后尝试将您的提交推送到远程。你不能面对任何错误,如果你有请在我的回答下发表评论。

Regards...

问候...

回答by VonC

If you have generate ssh keys, then you should use an ssh url

如果您生成了 ssh 密钥,那么您应该使用 ssh url

[email protected]:user/repo

If you keep using https, then you need to enter in Eclipse your username and GitHub password: see "egit - not authorized".

如果您继续使用 https,那么您需要在 Eclipse 中输入您的用户名和 GitHub 密码:请参阅“ egit - 未授权”。

回答by I.R.1989

This can be associated with BitBucket (example) problem. Be patient and wait for them to solve this issue. If it worked before for you it will work again as soon as they fix the problem.

这可能与 BitBucket(示例)问题有关。耐心等待他们解决这个问题。如果它以前对你有用,一旦他们解决了问题,它就会再次工作。