TotoiseHG: An existing connection was forcibly closed by the remote host

3.2k Views Asked by At

I wanted to push a project from from TortoiseHg to GitHub. I know that, TortoiseHg is a front-end to the Mercurial distributed version control system; where GitHub works with Git. But I love to use TortoiseHg (instead of TortoiseGit or GitGui), and want to keep my project in GitHub.

So, I configured TortoiseHg (File>Settings>Extensions>hggit) and was able to push a test project to GitHub (following this wonderful blog). But later when I tried to push a C# MVC project with it, situation changed. It nicely starts pushing, then asks for authentication, & then shows this error-

An existing connection was forcibly closed by the remote host

Here is what shown in the log-

% hg push git+https://github.com/MinhasKamal/MVCPracticeWork
pushing to git+https://github.com/MinhasKamal/MVCPracticeWork
http authorization required for https://github.com/MinhasKamal/MVCPracticeWork/info/refs
realm: GitHub
searching for changes
adding objects
URLError: [Errno 10054] An existing connection was forcibly closed by the remote host
[command returned code 255 Thu Feb 04 16:17:02 2016]

I don't understand- why this error is happening. Is this a problem of GitHub or TortoiseHG, or I did something wrong? How it can be solved?


Edit 1: I am able to push to the repository but only by 'not adding' some specific directories to my repository. Is it any file type or name that is making this error?


Edit 2: The problem again happened with me, this time with a Java project. Everything was fine, till I added a *.jar file in the repository. I made a commit, but when I tried to push it to the GitHub, TortoiseHg showed me the same message. I removed the *.jar, committed, and tried to push again, but couldn't.

Now, I did again that I did before (Edit 1)- I pulled the whole repository from GitHub to another folder, replaced changed files from the current repository at my PC (did not add the *.jar), committed, and pushed; I was successful this time. So, this time the *jar file was not added to the version control database, that is why it worked.

4

There are 4 best solutions below

9
On BEST ANSWER

So far, after many comments, it seems the content of some binary file types (like- *.jar, *.mp3 etc. but not *.png) are problematic:

  • not file size (although it the file was really large, that would be an issue too, but it is not here)
  • not its extension (the OP adds "I had a photo and I renamed it to *.jar, and it worked")

To keep a similar end-user experience, a test would be to install a TortoiseGit, and see if a git push would work in a classic git clone repo.

4
On
  • I can't see any pushes to MinhasKamal/MVCPracticeWork: This repository is empty.
  • You can automate pushing process (no handwork, no timeouts, no input errors) using [auth] section in .hgrc of this repo (define username and password in it)
  • At least some initial test-pushes will be better to perform in pure CLI (more informative and readable output)
0
On

This problem only occurs when you use the HTTPS protocol. If you use SSH instead (which is awkward, but nevertheless possible on Windows) the push will succeed.

See https://www.mercurial-scm.org/pipermail/mercurial/2017-March/050304.html for more info. I suggest reading the whole thread, which is only six messages.

2
On

There is a problem with Github if you trying to add a super large file into any repo. Even though i don't know if that's your problem.

I had a change to commit with both HG and Git on my Mac and try to push it to github. Git shown me the file is too large message when I ran git push but HG only shown me push failed.

If your .jar or any of the file you added cause the problem, you can check if the file size excess the limit (from github) and this one