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:
- Step 1. Check if you have existing default identity
- Step 2. Create your default identity
- Step 3. Enable SSH compression for Mercurial
- Step 4. Start Pageant and install your private key
- Step 5. Provide us with the public key
- Step 6. Clone the project
- Step 7. Configure your local repository to use the SSH protocol
- Step 8. Make a change under the new protocol
Creating a SSH key pair:¶
Create your keypair with
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://email@example.com/projectname to access your repo, you replace firstname.lastname@example.org 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
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.
- 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.
- 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.
- Copy the contents of the box under Public key to a plain text file and save the file.
- Enter and confirm a key passphrase.
- 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.
- 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:
- Start the TortoiseHg Workbench.
- Select File > Settings.
- Make sure you have the global settings tab selected.
- Press Edit File.
- 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 <email@example.com> ssh = "C:\Program Files\TortoiseHg\TortoisePlink.exe" -ssh -2 -batch -C
- Press Save to store your settings and close the file.
- 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:
- 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:
- Double-click the Pageant icon to launch the Pagent Key List dialog.
- Click the Add Key button.
The system displays the Select Private Key File dialog.
- Navigate to and open the default key you created previously.
- Enter the passphrase when prompted:
- Press OK.
Pageant shows your key in the running list.
- 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:
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.
- Start TortoiseHG.
- Right click your myquotefork repository and choose Settings.
The system displays the TortoiseHG Settings dialog with the myquotefork repository settings tab active.
- Press Edit File.
- View your current repository configuration.
You should see something similar to the following:
[paths] default = https://hg.openttdcoop.org/PROJECTNAME
- 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://firstname.lastname@example.org/PROJECTNAME
- Press Save to close the editor.
- Press OK to close the settings dialog.
- Restart TortoiseHG Workbench so that it uses the new SSH setting.
Step 8. Make a change under the new protocol¶
- Edit any file in your PROJECTNAME repository.
- Add a new line to the file.
- Save and close the file.
- Add and then commit your change to your local repository.
- Push your changes to your fork.
A successful push shows in your TortoiseHG log as follows:
pushing to ssh://email@example.com/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.
- Open the repository Overview on the DevZone to view your commit.
Note: we need the key in OpenSSH format.
Continue with setting up Installing NML