Mercurial is a free, distributed source control management tool. This tutorial uses Cygwin to install and work with Mercurial.
Cygwin is:
Download Cygwin:
http://www.cygwin.com/
Click on the setup.exe file to begin the installation.
If you don't already have iTunes installed, download bonjour: http://support.apple.com/kb/DL999
You will receive and email from your instructor with the key files. You need to put key files (academy and academy.pub) where Mercurial can find them.
Open the Cygwin terminal
You will be in your home directory by default. Your prompt with look something like:
annakaziunasfrance@AKAZIUNA8765 ~
$
Where "YourUsername" is the name of your home folder.
Type the following text into the terminal after the prompt:ls .ssh
ls: cannot access /home/akaziuna/.ssh: No such file or directorythen you need to create the .ssh folder. If you do not get this message, skip the command below.
mkdir .ssh
Within the .ssh directory you need to create another directory called keys.
To do this type:
mkdir .ssh/keys
Download the keys that your instructor sent you in an email. They are named academy and academy.pub. You will need to place them in the keys directory.
To do this, save the key files from the email to:
Computer > Local Disc(C:) > cygwin > home > yourNameDirectory
Next, we need to change the permissions on the keys. You need to set permissions for your private key so that only you have read/write access to them.
Type:
chmod 644 academy.pub
Then type:
chmod 600 academyYou need to move both of the keys from your desktop to the keys directory that you created earlier.
Type:
mv academy .ssh/keysThen type:
mv academy.pub .ssh/keys
Both keys are now located in the .ssh directory.
You can check to see by typing:
ls -l .ssh/keys to list the contents of the directory.
You should see that academy and academy.pub are listed.
You will need to set the port that ssh uses to access fabacademy.org. You can do this by creating and editing a config file within your .ssh directory.
Type:
nano config
A text editor will open. Next we need to edit the file.
Add the following text to the text editor in the terminal window:
host fabacademy.org port 846
To save the file:
- press [control]+O to save the file
- press [control]+X to exit the editor
Do not add any extension to the file name. Now we need to move it to the .ssh directory.
Type:
mv config .ssh/keys
Mercurial will ask you for a password. Ask your instructor for the password.
Now we need to clone the archive for you region: na=North America, sa=South America, eu=Europe, as=Asia, af=Africa. Ask your Local Instructor or Remote Guru what archive to clone. In this example we are copying the North American (na) repository.
For convenience, we will clone it to the desktop.
Copy the text and paste it into the terminal:
hg clone -e "ssh -p 846 -i ~/.ssh/keys/academy" ssh://hg@fabacademy.org/academy.2015/Web/na academy.2015
If you are cloning for the first time, you will be told that the "authenticity of the host cannot be established" and are given the option to type "yes" or "no".
Type "yes"
You should see the following response (or a similar response)in the terminal as the archive is cloned. Success!
requesting all changes adding changesets adding manifests adding file changes added 10 changesets with 119 changes to 112 files updating to branch default 111 files updated, 0 files merged, 0 files removed, 0 files unresolved
A folder named academy.2015 has been created in your home directory in the Cygwin folder. This folder contains the archive content.
You can navigate there through the GUI (Graphical User Interface) by clicking through the following folders: Computer > Local Disc(C:) > cygwin > home > yourNameDirectory
Now you need to edit your archive's personal configuration file. To do this you need to move into the archive folder named "academy.2015" that you just created in your home directory.
Type:
cd academy.2015
You are now within the academy.2015 directory.
To edit your archive's personal configuration file (called hgrc) to reflect your name and email we need to open the file in a editior:
Type:
nano .hg/hgrc
A text editor will open inside the terminal window.
This text should already be in the file:
[paths]
default = ssh://hg@fabacademy.org/academy.2015/Web/na
Put the following text in the file.
[ui] username = First Last <user@machine.domain> ssh = ssh -p 846 -i ~/.ssh/keys/academy -C [hooks] changegroup = hg update >&2
To save the file:
- press [control]+O to save the file
- press [control]+X to exit the editor
Do not add an extension to the file name.
Now try updating your archive by typing:
hg pull
you should see a response like this:
pulling from ssh://hg@fabacademy.org/academy.2015/Web/na searching for changes no changes found
Congratulations! You have been successful and you can now work with the archive. Look over the Mercurial basics and resources page.
However, if you get a response like this:
pulling from ssh://hg@fabacademy.org/academy.2015/Web/na searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 2 changes to 2 files
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
(run 'hg update' to get a working copy)
Type "hg update", now you are successful.
remote: ssh: connect to host fabacademy.org port 846: Connection refused abort: no suitable response from remote hg!
Then you forgot to edit the config file (see step 6)
Tutorial by Anna Kaziunas France - Last Updated January, 28th 2015