eclipse 如果出现以下错误,我如何推送到 Git Repo:推送期间发生内部异常:ssh://[email protected]/xxx/xxx.git: session is down

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

How do I push to Git Repo given the following error: An internal Exception occurred during push: ssh://[email protected]/xxx/xxx.git: session is down

eclipsesshegit

提问by punkle

I recently set up a github account to store the source code of a project I have been working on.

我最近设置了一个github帐户来存储我一直在做的一个项目的源代码。

I am using egit eclipseplugin to push changes to github.

我正在使用egit eclipse插件将更改推送到github

I successfully pushed the initial code and 2 subsequent changes. However when I attempted to push the third change I was not able. The following excepiton appears in the eclipse error log.

我成功推送了初始代码和 2 个后续更改。然而,当我试图推动第三个变化时,我无法做到。eclipse 错误日志中出现以下异常。

If someone could tell me the cause of this error, or tell me how I can go about debugging the problem it would be a great help.

如果有人能告诉我这个错误的原因,或者告诉我如何调试问题,那将是一个很大的帮助。

org.eclipse.jgit.api.errors.JGitInternalException: Exception caught during execution of push command
    at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:156)
    at org.eclipse.egit.core.op.PushOperation.run(PushOperation.java:227)
    at org.eclipse.egit.ui.internal.push.PushOperationUI.execute(PushOperationUI.java:145)
    at org.eclipse.egit.ui.internal.push.PushOperationUI.run(PushOperationUI.java:202)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.eclipse.jgit.errors.TransportException: ssh://[email protected]/xxx/xxx.git: session is down
    at org.eclipse.jgit.transport.JschSession$JschProcess.<init>(JschSession.java:154)
    at org.eclipse.jgit.transport.JschSession$JschProcess.<init>(JschSession.java:118)
    at org.eclipse.jgit.transport.JschSession.exec(JschSession.java:91)
    at org.eclipse.jgit.transport.TransportGitSsh$SshPushConnection.<init>(TransportGitSsh.java:306)
    at org.eclipse.jgit.transport.TransportGitSsh.openPush(TransportGitSsh.java:152)
    at org.eclipse.jgit.transport.PushProcess.execute(PushProcess.java:130)
    at org.eclipse.jgit.transport.Transport.push(Transport.java:1120)
    at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:152)
    ... 4 more
Caused by: com.jcraft.jsch.JSchException: session is down
    at com.jcraft.jsch.Session.openChannel(Session.java:750)
    at org.eclipse.jgit.transport.JschSession$JschProcess.<init>(JschSession.java:147)
    ... 11 more

采纳答案by FFL

I experienced the same issue. Resolution follows:

我遇到了同样的问题。决议如下:

  • Delete origin push and fetch in remote(Eclipse view --> Git repositories).
  • Close Eclipse.
  • Go to .sshfolder(Users/.ssh) and delete the key files(publicand private).
  • Start eclipse and regenerate the keys(Window --> Preferences --> General tab --> Network connections --> SSH2).
  • Copy the key and add it to github/SSHKeys
  • In Eclipse add new remoteand push.
  • 删除 remote( Eclipse view --> Git repositories) 中的origin push 和 fetch 。
  • 关闭日食。
  • 转到.ssh文件夹(Users/.ssh)并删除密钥文件(publicprivate)。
  • 启动eclipse并重新生成keys( Window --> Preferences --> General tab --> Network connections --> SSH2)。
  • 复制密钥并将其添加到github/SSHKeys
  • 在 Eclipse 中添加新的 remotepush


EditYou may not need to delete all the key files. If you have already added a key file previously (perhaps while setting up native Git), you can just add the name of that file in list of keys, and it will work.

编辑您可能不需要删除所有密钥文件。如果您之前已经添加了一个密钥文件(可能是在设置本机 Git 时),您只需在密钥列表中添加该文件的名称,它就会起作用。

回答by Michael Lee

This seemed to work for me:

这似乎对我有用:

Do everything Firoz and Nishant say except push: https://stackoverflow.com/a/9889350

做 Firoz 和 Nishant 除了推送之外的所有事情:https: //stackoverflow.com/a/9889350

Create or edit the following file on your desktop:

在桌面上创建或编辑以下文件:

File : ~/.ssh/configContent :

文件:~/.ssh/config内容:

Host github.com
    User [your_github_username]
    Hostname github.com
    PreferredAuthentications publickey
    IdentityFile [path_to_private_key]

In your Eclipse Git Setup for your project do the following:

在您的项目的 Eclipse Git 设置中,执行以下操作:

  1. URI : git@github.com:[repo_owner_username]/[repo_name].git
  2. Protocol : ssh
  3. Username : git
  4. Password : [leave_blank]
  5. Save and push.
  1. URI : git@github.com:[repo_owner_username]/[repo_name].git
  2. 协议:ssh
  3. 用户名:git
  4. 密码:[leave_blank]
  5. 保存并推送。

See this GitHub SSH Help page for useful info: http://help.github.com/ssh-issues/

有关有用信息,请参阅此 GitHub SSH 帮助页面:http: //help.github.com/ssh-issues/

Worked for me after initially suffering through "session is down" and "cannot open git-upload-pack" errors. Hope it helps everyone else too.

在最初遭受“会话已关闭”和“无法打开 git-upload-pack”错误后对我来说有效。希望它也能帮助其他人。

Good luck!

祝你好运!

回答by Aneesh Garg

I faced the same problem and I found out solution which is extremely foolish.
I took following steps:

我遇到了同样的问题,我找到了非常愚蠢的解决方案。
我采取了以下步骤:

  • I logged into git repositoryof my project from browserand didn't sign out.
  • I copied the http urlto pushor pullfrom project repository from github.
  • I pasted the urlin my eclipse pluginwhile pushing code (didn't use the already stored one even though both of them were same)
  • 我从浏览器登录到我的项目的git 存储库并且没有退出。
  • 我复制了http url以从github 的项目存储库中推送取。
  • 我在推送代码时将url粘贴到我的eclipse 插件中(即使它们都相同,也没有使用已经存储的一个)

I don't know what and why but above steps have worked for me whenever I have faced above problem. I don't know why does eclipse throw such exceptions and why does it gets solved this way.

我不知道是什么以及为什么,但是每当我遇到上述问题时,上述步骤都对我有用。我不知道为什么 eclipse 会抛出这样的异常以及为什么它会以这种方式解决。

You can also try pushing using other ways outside of eclipse. for eg. `TortoiseGit` or `SmartGit` etc.

您也可以尝试使用 eclipse 之外的其他方式进行推送。例如。`TortoiseGit` 或 `SmartGit` 等。

回答by Ankur

I had the same problem. I fixed it by pointing the JAVA_HOMEvariable to jdk 6. It was originally pointing to jdk 5.

我有同样的问题。我通过将JAVA_HOME变量指向jdk 6来修复它。它最初指向jdk 5

回答by Andrew Koper

I got this error message and it was fixed when one of my co-workers emailed me the two files id_rsa and id_rsa (MS Pub doc), I put them in C:Users\[userID]\.ssh, and shut down and restarted my IDE.

我收到此错误消息,当我的一位同事通过电子邮件向我发送两个文件 id_rsa 和 id_rsa(MS Pub doc)时已修复,我将它们放在 C:Users\[userID]\.ssh 中,然后关闭并重新启动我的IDE。

回答by Asen52

I had this issue with EGit and solved it at last. Somehow sometimes things get messed up. If you can not solve it through Eclipse just go to your "git" folder with git bash with Windows. With Linux it is even easier: just open the terminal.

我在 EGit 上遇到了这个问题并最终解决了它。不知何故,有时事情会变得一团糟。如果您无法通过 Eclipse 解决它,只需在 Windows 中使用 git bash 转到您的“git”文件夹。使用 Linux 则更简单:只需打开终端即可。

This problem occurs because of username, password, and ssh keys getting messed up. So, use the commands "git remote show origin" and make sure if the origin is [email protected]......Sometimes Eclipse just puts "git" as a username so make sure you have the correct user name by changing it with the command git remote set-url origin https://[email protected]/restofthe url. It should automatically change the configurations in eclipse.

出现此问题是因为用户名、密码和 ssh 密钥弄乱了。因此,使用命令“git remote show origin”并确保源是否为[email protected]......有时 Eclipse 只是将“git”作为用户名,因此通过使用命令更改它以确保您拥有正确的用户名git remote set-url origin https://[email protected]/restofthe url。它应该会自动更改 eclipse 中的配置。

Best...

最好的事物...

回答by R.P

I also had this issue.

我也有这个问题。

The following command in Git Bash, comes handy in such scenarios: git remote prune origin

Git Bash 中的以下命令在这种情况下会派上用场: git remote prune origin

This configured the Pull/Push in the corrupted branch.

这在损坏的分支中配置了拉/推。