FLL

Fab Academy 2013

FAB LAB UNI | Lima - Perú

Mercurial in Windows

Cygwin + Openssh + Nano + Tortoise


I do this tutorial for the people who use Win OS. All the previous tutorials are for Linux based OS or for Mac. So I hope that tutorial could be usefull.

Installation

The process has 4 steps basically: (1) The Cygwin installation, (2) the SSH configuration, (3) the mercurial clonation in Cygwin platform, and (4) the TortoiseHg instalation optional).

Step 1: Cygwin Installation

  1. First download the Cygwin Setup [download].
  2. Then procced to install the cygwin, when the installer ask you for the Download Sourse, choose the first option ("Install from internet").
  3. Choose the installation directory (the default is "C:/cygwin")
  4. Change the Local package directory to the same install directory of the Cygwin.
  5. Then procede with the installation, when you reach the Package Selection step you need to install 3 packages:
    1. Search "mercurial", then open Python branch (click on box), and after click on skip (the version number will apear).
    2. Search "openssh", then open Net branch and click on skip.
    3. Search "nano" (is text editor I used for this tutorial), open "Editors" branch and click on .







  6. Then click "Next" button and accept resolve all the package dependencies
  7. Finally click "Next" and wait the download of the program and their the packages.

Step 2: SSH Configuration

  1. Open the System propeties (or press [Win-key] + [Pause]) and go to Advanced tab.
  2. Then create a new System Variable (click in )
  3. In the window opened write in Variable name:
    Cygwin
    and in Variable value:
    ntsec
    then .
  4. Then in System Variable table, look for "Path" variable and modify it (click in ).
  5. In Variable Value: add at the end ";c:\cygwin\bin", accept and close all the windows and thats all.

Step 3: Cloning with Mercurial

  1. Open the Cygwin Bash Shell.
  2. Create a folder called ".ssh" inside the "~" folder, you can type in Cygwin:
    mkdir .ssh   [Enter] 
  3. Then create a folder called "keys" inside the ".ssh" folder, you can type:
    mkdir .ssh/keys  [Enter] 
  4. Copy the key files (academy & academy.pub) to the keys folder.
  5. Now change the mode of the academy file to only read&write, type in Cygwin:
    chmod 600 .ssh/keys/academy   [Enter] 
  6. Now we need to create the config file using Nano text editor, so type:
    nano  [Enter] 
    Inside nano write:
    host fab.cba.mit.edu   [Enter]
    port 846   [Enter]
  7. To exit press [Ctrl]+[X] then press [Y] to save the file, save as config [Enter]
  8. Chose the folder where you want to create your cloned repository browsing with the Cygwin. Personally I prefer to clone closed to the home of the Cygwin (the folder where the cygwin start when you open it).
  9. Then type:
    hg clone -e "ssh -p 846 -i ~/.ssh/keys/academy"
                   ssh://hg@fab.cba.mit.edu/academy FabLab    [Enter]
    (the last word of the code is the name of the folder of the clonation)
  10. Wait for the download (could take several hours, depending of your internet connection). When the clonation is complete (you will notice your cloned file will no increse his sise)
  11. Now I need to modificate the "hgrc" file inside the ".hg" folder (that folder was create inside the clonated folder) to modify open it and type:
    nano hgrc   [Enter]
    (of course yo need to locate the folder with the cygwin navigator if you want to open using this code)
  12. Inside the nano add:
  13. [ui]   [Enter]
    Username = Your Name <your_e-mail@server.ext>  [Enter]
    ssh = ssh –p 846 –i ~/.ssh/keys/academy –C   [Enter]
    editor = nano     [Enter]
    [hooks]   [Enter] 
    changegroup = hg update >&2  [Enter]
  14. To exit press [Ctrl]+[X] then press [Y] and [Enter] to save the file with the same name.

That's all. Now you can upload your files. Check the "Mercurial Notes" [Link]

Step 4: TortoiseHg Installation
(optional)

Why I tell it's optional?, because the clonation, pulling, pushing, adding, etc, etc, etc of Mercurial, doesn't need TortoiseHg to function. The tortoiseHg is a graphical interfase for the Mercurial.


Without TortoiseHG


With TortoiseHG

The only think to do is download the TortoiseHg installer package and after install reboot your system. [download]