mercurial hg-git cannot push to github

Steve Fink sphink at gmail.com
Wed Nov 20 05:06:29 UTC 2019


hg expects to speak the mercurial protocol to an https:// URL. You
need to tell it to speak git by prefixing the URL with `git+`:

    hg clone git+https://github.com/ThePythonicCow/rawscan.git rawscan

Note that this will be pull-only. If you want to push, you'll need to use

    hg push git at github.com:ThePythonicCow/rawscan.git

or

    hg push git+ssh://git@github.com/ThePythonicCow/rawscan.git

In practice, you'll probably want to embed the correct url in the
[paths]default of [paths]default-push setting of the checkout's
.hg/hgrc file.

Read `hg help git` for a discussion of the paths being used. Though
I'm not entirely sure why that git@ one works, given that description.

On Tue, Nov 19, 2019 at 5:03 PM Paul Jackson <pj at usa.net> wrote:
>
> I have just started using mercurial hg-git , well, started re-using it,
> after noticing that the mercurial alternative to git that I preferred
> back when I was doing Linux kernel work circa 2005 was alive and
> well and growing stronger.
>
> Before checking in anything serious with hg, I decided just now to
> try a trivial checkin, just to make sure I had the basics working.
>
> That failed.   To quote (edited and reformatted) what I wrote just now on the #mercurial IRC chat:
>
> ==========
>
> I can't get mercurial to work with a git clone.  Just doing the following failed:
>
> hg clone https://github.com/ThePythonicCow/rawscan.git rawscan
> cd ./rawscan
> hg push
>
>
> That failed with:
>
> pushing to https://github.com/ThePythonicCow/rawscan.gitabort: git remote error: unexpected http resp 401 for https://github.com/ThePythonicCow/rawscan.git/info/refs?service=git-receive-pack
>
> The "./rawscan" subdirectory did not exist prior to step 1, above.
>
> ===
>
> I am using hg version 4.8.2, on Ubuntu 19.10
>
> I have mercurial-git 0.8.12-1.1j installed..
>
> ===
>
> On the off chance that the push was failing because I not made any changes to my local clone, I made a small change to an existing file, did a (1) hg commit -m"a small change" that_file, and (2) hg push again.
>
> Same error message on the push:
>
> abort: git remote error: unexpected http resp 401 for https://github.com/ThePythonicCow/rawscan.git/info/refs?service=git-receive-pack
>
> ===
>
> To verify that git, as opposed to hg,  still worked to do the same thing, I did a fresh
>
> git clone  https://github.com/ThePythonicCow/rawscan.git rawscan_fresh_git.dir
> cd ./rawscan_fresh_git.dir
> edit .gitignore
> git add .gitignore
> git commit -m"adapt .gitignore to mercurial limitations (no ! terms)"
> git push
>
>
> That worked fine
>
> You can view my newly edited file at https://github.com/ThePythonicCow/rawscan/blob/master/.gitignore
>
> ==========
>
> I have no idea whether this is a "newbie" problem, a problem specific to my setup, or some
> wider problem.
>
> --
>                 Paul Jackson
>                 pj at usa.net
> _______________________________________________
> Mercurial mailing list
> Mercurial at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial



More information about the Mercurial mailing list