Currently, there is a SSH Account needed for write access to our Mercurial Repos. Please create a ticket with your key file attached here in the DevZone help centre. Also please contact the Project Manager of the projects you want to contribute to and ask him to provide you with the needed permissions.

Creating a SSH key pair:

*nix

Create your keypair with

ssh-keygen

Specific key in ssh config file

By default, ssh will try to use the default key when accessing the repo. If you want to use a specific key for openttdcoop, you can create the following config file in your .ssh directory (usually in your home folder):

Host <alias>
    HostName hg.openttdcoop.org
    User hg
    IdentityFile /full/path/to/private-key

Bash expansions like ~ work with the IdentityFile. Replace the <alias> with one suitable for you.

Then, instead of using ssh:///projectname to access your repo, you replace with the <alias> you specified in the config file. You can do this in your project directory projectname/.hg/hgrc:

[paths]
default = ssh://<alias>/projectname

Windows

Step 1. Check if you have existing default identity

TortoiseHG relies on the PuTTYgen utility to generate an identity. If you are following along in this tutorial, you should have already installed PuTTYgen. If you used PuTTYgen in the past to generate an identity, you should have an identity.ppk file on your system. If you have an existing private key, you can skip Step 2 below and go onto Enable SSH compression for Mercurial. Otherwise, continue to the next step.

Step 2. Create your default identity

The following procedure creates a default identity with PuttyGen. PuttyGen generates keys in its own format. So, rather than re-use the file you created for use within GitBash, you'll create a different key for TortoiseHG.

  1. Locate the puttygen.exe executaible in your system and double click the icon to start it.
    If you are following along with this tutorial, you installed PuTTYgen in C:\Program Files\TortoiseHG. The system opens the PuTTY Key Generator dialog.
  2. Complete
  3. Press Generate.
    Following the instructions to generate some randomness.

    When the generation completes, the system displays the public key and a number of other fields.
  4. Copy the contents of the box under Public key to a plain text file and save the file.
  5. Enter and confirm a key passphrase.
  6. Press Save private key.
    The system prompts you for a location to save the file and a file name. By convention, store your key files in a folder called C:\Users\yourname\ssh. and give it a .ppk extension.
  7. Go ahead and close PuTTYgen.

Step 3. Enable SSH compression for Mercurial

Mercurial does not automatically do compression. If you are using Mercurial, you should enable SSH compression as it can speed up things drastically, in some cases. To enable compression for Mercurial, do the following:

  1. Start the TortoiseHg Workbench.
  2. Select File > Settings.
  3. Make sure you have the global settings tab selected.
  4. Press Edit File.
  5. Add the following line to the UI section:
    ssh = "TortoisePlink.exe" -ssh -2 -batch -C
    

    When you are done the file should look similar to the following:
        [ui]
        # Name data to appear in commits
        username = Mary Anthony <manthony@atlassian.com>
        ssh = "C:\Program Files\TortoiseHg\TortoisePlink.exe" -ssh -2 -batch -C
    
  6. Press Save to store your settings and close the file.
  7. Press OK to close the settings dialog.

Step 4. Start Pageant and install your private key

TortoiseHG comes with Pageant which is an SSH authentication agent. You load your keys into Pageant and it automatically authenticates you so you don't need to enter your passphrase. Do the following to load your keys:

  1. Start Pageant by double clicking its icon.
    By default, TortoiseHG installs the Pageant in the C:\Program Files\TortoiseHG folder. When it is running, Pageant appears in your system tray:
  2. Double-click the Pageant icon to launch the Pagent Key List dialog.
  3. Click the Add Key button.
    The system displays the Select Private Key File dialog.
  4. Navigate to and open the default key you created previously.
  5. Enter the passphrase when prompted:
  6. Press OK.
    Pageant shows your key in the running list.
  7. Press Close to close the dialog.
    Pageant continues to run on your system.

Step 5. Provide us with the public key

You can send us a link to your webspace or use our Tracker here and attach it. We'll handle that request as soon as possible. We need a paste of the key as shown above in the image of step 2.4. You can copy from the file you created during step 2.4.

Step 6. Clone the project

If you have no local clone of the project yet, obtain on. From Tortoise main menu choose 'clone archive' and choose as URL like http://hg.openttdcoop.org/PROJECTNAME. Choose also a local path which suits you, where you want your project to reside.

Step 7. Configure your local repository to use the SSH protocol

The URL you use for a repository depends on which protocol you are using, HTTP and SSH. You can only commit to the repository via SSH, while everyone can clone the repository via HTTP. The URLs are:
SSH: ssh:///PROJECTNAME
HTTP: http://hg.openttdcoop.org/PROJECTNAME
HTTPS: https://hg.openttdcoop.org/PROJECTNAME

Got to your local system and navigate to your repository (the only Mercurial repository you've worked with so far). These instructions assume you have added the repository to the TortoiseHG Workbench.

  1. Start TortoiseHG.
  2. Right click your myquotefork repository and choose Settings.
    The system displays the TortoiseHG Settings dialog with the myquotefork repository settings tab active.
  3. Press Edit File.
  4. View your current repository configuration.
    You should see something similar to the following:
        [paths]
        default = https://hg.openttdcoop.org/PROJECTNAME
    
  5. Change the default value to use the SSH format for that repository.
    When you are done you should see something similar to the following:
        [paths]
        default = ssh://hg@hg.openttdcoop.org/PROJECTNAME
    
  6. Press Save to close the editor.
  7. Press OK to close the settings dialog.
  8. Restart TortoiseHG Workbench so that it uses the new SSH setting.

Step 8. Make a change under the new protocol

  1. Edit any file in your PROJECTNAME repository.
  1. Add a new line to the file.
  2. Save and close the file.
  3. Add and then commit your change to your local repository.
  4. Push your changes to your fork.
    A successful push shows in your TortoiseHG log as follows:
        pushing to ssh://hg@hg.openttdcoop.org/PROJECTNAME
        searching for changes
        remote: adding changesets
        remote: adding manifests
        remote: adding file changes
        remote: added 1 changesets with 1 changes to 1 files
        remote: bb/acl: newuserme is allowed. accepted payload.
        [command completed successfully Mon Dec 19 10:49:06 2011]
        PROJECTNAME
    

    PuTTY may warn you that the host key is not yet stored. If that happens, press Yes to add the DevZone's host key.

  5. Open the repository Overview on the DevZone to view your commit.

These instructions are adopted from Atlassian's guide and released under the Creative Commons Attribution

Note: we need the key in OpenSSH format.

Continue with setting up Installing NML

pageant_runs.png (20.8 KB) planetmaker, 2014-02-07 09:25