How to save username and password with Mercurial?

后端 未结 8 1853
执念已碎
执念已碎 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 01:15

    While it may or may not work in your situation, I have found it useful to generate a public / private key using Putty's Pageant.

    If you are also working with bitbucket (.org) it should give you the ability to provide a public key to your user account and then commands that reach out to the repository will be secured automatically.

    If Pageant doesn't start up for you upon a reboot, you can add a shortcut to Pageant to your Windows "Start menu" and the shortcut may need to have a 'properties' populated with the location of your private (.ppk) file.

    With this in place Mercurial and your local repositories will need to be set up to push/pull using the SSH format.

    Here are some detailed instructions on Atlassian's site for Windows OR Mac/Linux.

    You don't have to take my word for it and there are no doubt other ways to do it. Perhaps these steps described here are more for you:

    1. Start PuttyGen from Start -> PuTTY-> PuttyGen
    2. Generate a new key and save it as a .ppk file without a passphrase
    3. Use Putty to login to the server you want to connect to
    4. Append the Public Key text from PuttyGen to the text of ~/.ssh/authorized_keys
    5. Create a shortcut to your .ppk file from Start -> Putty to Start -> Startup
    6. Select the .ppk shortcut from the Startup menu (this will happen automatically at every startup)
    7. See the Pageant icon in the system tray? Right-click it and select “New session”
    8. Enter username@hostname in the “Host name” field
    9. You will now log in automatically.

提交回复
热议问题