How to save username and password with Mercurial?

后端 未结 8 1864
执念已碎
执念已碎 2020-11-28 00:26

I used Mercurial in a personal project, and I have been typing my username and password every time I want to push something to the server.

I tried adding the followi

8条回答
  •  无人及你
    2020-11-28 00:59

    A simple hack is to add username and password to the push url in your project's .hg/hgrc file:

    [paths]
    default = http://username:password@mydomain.com/myproject
    

    (Note that in this way you store the password in plain text)

    If you're working on several projects under the same domain, you might want to add a rewrite rule in your ~/.hgrc file, to avoid repeating this for all projects:

    [rewrite]
    http.//mydomain.com = http://username:password@mydomain.com
    

    Again, since the password is stored in plain text, I usually store just my username.

    If you're working under Gnome, I explain how to integrate Mercurial and the Gnome Keyring here:

    http://aloiroberto.wordpress.com/2009/09/16/mercurial-gnome-keyring-integration/

提交回复
热议问题