6

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.

Minhas Kamal
  • 20,752
  • 7
  • 62
  • 64
  • Your version of THG and hg-git have to be shown, maybe they are ancient as mammoth's bullshit – Lazy Badger Feb 05 '16 at 05:19
  • Are you behind a proxy? (as in http://stackoverflow.com/q/6554921/6309) – VonC Apr 16 '16 at 17:21
  • @VonC I am not sure, may be I am not behind any proxy. – Minhas Kamal Apr 16 '16 at 17:41
  • I don't think you are actually, since you can push without certain files – VonC Apr 16 '16 at 17:42
  • What version of TortoiseHg, and git are you using? – VonC Apr 16 '16 at 17:42
  • @VonC TortoiseHg version is- *3.6.3*, Mercurial- *3.6.3*, Qt- *4.8.6*. I am pushing Mercurial repository to GitHub using an add-in **hg-git**. So, git version should be the latest. – Minhas Kamal Apr 16 '16 at 17:47
  • OK. I was reading http://support.hglabhq.com/discussions/problems/396-when-pushing-files-over-some-20mb-i-get-abort-error-an-existing-connection-was-forcibly-closed-by-the-remote-host, but that was 3 years ago. – VonC Apr 16 '16 at 17:50
  • @VonC And my file size was only 380kb. – Minhas Kamal Apr 16 '16 at 17:51
  • Can you check if you have a mercurial.ini in your user directory (%USERPROFILE% if you are on Windows) as in http://stackoverflow.com/a/10298166/6309? (or http://stackoverflow.com/a/6554938/6309) – VonC Apr 16 '16 at 17:54
  • @VonC Yes, I have. Should I delete it? Here is the content- [extensions] \n hggit = \n eol= \n [ui] \n username=MinhasKamal \n [auth] \n github.com.prefix = github.com \n github.com.username = MinhasKamal \n – Minhas Kamal Apr 16 '16 at 17:56
  • OK, so no proxy entry there, you can leave it as is. – VonC Apr 16 '16 at 17:58
  • Are you on Windows? Does your TortoiseHG uses IIS in any way? (as in http://stackoverflow.com/a/17372530/6309) – VonC Apr 16 '16 at 17:59
  • @VonC I am on Windows. I have VisualStudio in my PC, but IIS was not running. So, It should not be used by TSVN. – Minhas Kamal Apr 16 '16 at 18:07
  • Do you have git in your %PATH%? What `git --version` returns? – VonC Apr 16 '16 at 18:13
  • @VonC I don't have Git installed in my PC. I don't know what happens while installing TortoiseHG, it should not install Git too. I do have EGit, which come with Eclipse, which cannot affect TortoiseHG. – Minhas Kamal Apr 16 '16 at 18:19
  • @MinhasKamal OK, so no local git needed here. Can you check if your current TortoiseHG-hggit would work better with python 2.7.x instead of python 3.x? – VonC Apr 16 '16 at 18:24
  • @VonC How should I do that? Do you mean about the python installed in my PC? It is "Python 2.7.9rc1". – Minhas Kamal Apr 16 '16 at 18:31
  • @MinhasKamal 2.7 should be fine. Maybe the reverse could be tested, installing python 3.3? I am just searching what factor would cause such an error message. – VonC Apr 16 '16 at 19:17
  • @MinhasKamal Also, just for test, what would happen if you were to rename your jar file in myfile.jar.txt, and then push it? – VonC Apr 16 '16 at 19:18
  • @VonC I renamed \*.jar with \*.txt extension, and I could not push. Then I renamed a \*.png file to \*.jar, but I could push. [This](https://github.com/MinhasKamal/test) is the repository. – Minhas Kamal Apr 17 '16 at 02:03
  • @MinhasKamal so in png, it is ok, not in jar or txt? – VonC Apr 17 '16 at 02:05
  • @VonC I had a photo & I renamed it to *.jar, & it worked. So It is not file type rather file content that is causing the problem. – Minhas Kamal Apr 17 '16 at 02:11
  • @VonC May be we could not figure out "how to solve the problem", but we were able to understand- "how we cannot solve it". Can't that be an answer too? – Minhas Kamal Apr 17 '16 at 08:49
  • @MinhasKamal I agree. I have added an answer summarizing the conclusions so far. – VonC Apr 17 '16 at 11:01
  • I'm having the exact problem you have, but your solution does not apply to me. I'm trying to push the exact same files from my local repository to a new GitHub repository and get the error. If I push to the old repo, no problem and if I make a new local repository, no problem, but I need to push existing commits to the new repo. It must be something with my local .hg folder. – Mark Jeronimus Aug 05 '16 at 11:55
  • @MarkJeronimus The accepted answer does not give any solution, it simply addresses probable cause of the problem. If your are a fan of TortoiseHG, like me, but want to push in GitHub, then believe me, you are going to love [SourceTree](https://www.sourcetreeapp.com/). I tried TortoiseGit, EGit, & GitGui; but SourceTree is the closest I got to TortoiseHG. – Minhas Kamal Aug 06 '16 at 09:31

4 Answers4

2
  • 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)
Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
  • You cannot see any push cause- I could not. I tested push in repository- https://github.com/MinhasKamal/test. I was also able to push in repository- https://github.com/MinhasKamal/Egami a few minutes ago. So, there should not be any problem in version. Thanks a lot for your response. :) – Minhas Kamal Feb 05 '16 at 05:46
  • 1
    @MinhasKamal - with `hg push -v --debug` you can see **a lot of** useful (?) data – Lazy Badger Feb 05 '16 at 06:35
  • Where should I write this (hg push -v --debug) command in TortoiseHG? – Minhas Kamal Feb 05 '16 at 06:48
  • @MinhasKamal - out of ideas. I said about command-line and resolving your *real problem* – Lazy Badger Feb 05 '16 at 09:08
2

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

SharkIng
  • 178
  • 1
  • 13
2

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.

Minhas Kamal
  • 20,752
  • 7
  • 62
  • 64
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I also tried with other *.jar files, and it did not work. I tried also with *.mp3 file (a song), it did not work either. :( – Minhas Kamal Apr 17 '16 at 11:54
  • @MinhasKamal so a binary content seems to be systematically an issue. – VonC Apr 17 '16 at 11:55
  • Exactly. But not for image. – Minhas Kamal Apr 17 '16 at 11:55
  • @MinhasKamal I don't know Mercurial enough but I suspect some encoding issue which might affect the content of those file during transfer. – VonC Apr 17 '16 at 11:56
  • @MinhasKamal At this point, I would test cloning the repo with git (instead of hggit) elsewhere on your computer, add those problematic files, commit and see if the push works that way. – VonC Apr 17 '16 at 11:57
  • Yes, like- `null` or something. – Minhas Kamal Apr 17 '16 at 11:58
  • @MinhasKamal I have added a link to TortoiseGit, if you want to keep a similar GUI as TortoiseHg. – VonC Apr 17 '16 at 11:59
  • So, It seems like a TortoiseHG's hg-git extension issue, for certain types of binary files. There is also a slight possibility for GitHub issue too. I have changed your answer a bit, please verify if it is right. – Minhas Kamal Apr 18 '16 at 04:19
  • @MinhasKamal Thank you for the edit: the answer is clearer now. – VonC Apr 18 '16 at 04:33
2

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.

William Gross
  • 2,083
  • 2
  • 17
  • 35