Mercurial is a free, distributed source control management tool. This tutorial covers how to install Mercurial on Ubuntu and clone the Fab Academy archive.
You need ssh (secure shell) to communicate with the Fab Academy server in order to clone and communicate with the shared archive. It should be installed by default, but just in case...
sudo apt-get install sshThen to instal Mercurial - Type:
sudo apt-get install mercurial
You need to put key files (academy and academy.pub) where Mercurial can find them.
You will be in your home directory by default. Your prompt with look like:
Where "YourUsername" is the username you created to login to Ubuntu.
Type the following text into the terminal after the prompt:
You system will ask you for a password - type in the password you use to log in to Ubuntu.
Within the .ssh directory you need to create another directory called keys. To do this type:
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 to your desktop from the email.
Change your location in the terminal by moving to the Desktop folder.
Your prompt should now look like: YourUsername@ubuntu:~/Desktop$
You need to move both of the keys from your desktop to the keys directory that you created earlier.
mv academy ~/.ssh/keysThen type:
mv academy.pub ~/.ssh/keys
You need to set permissions for your private key so that only you have read/write access to them.
chmod 600 ~/.ssh/keys/academyThen type:
chmod 644 ~/.ssh/keys/academy.pub
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.
To open the file with the nano text editor, type:
The nano text editor will open in the terminal window.
Add the following text to the empty file:
host fabacademy.org port 846
To save the file:
- press [control]+O to save the file (then the enter key)
- press [control]+X to exit the editor
Do not add any extension to the file.
Now we need to move it to the .ssh directory.
mv config ~/.ssh/keys
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 below and paste it into the terminal:
hg clone -e "ssh -p 846 -i ~/.ssh/keys/academy" ssh://email@example.com/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".
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
Now you need to edit your archive's personal configuration file. To do this you need to move into the archive folder that you just created on the desktop. It is called academy.2015
You are now within the academy.2015 directory. Your path should change to : YourUsername@ubuntu:~/Desktop/academy.2015$
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:
A text editor will open outside of the terminal window. This text should already be in the file:
default = ssh://firstname.lastname@example.org/academy.2015/Web/na
Put the following text in the file.
[ui] username = First Last <email@example.com> ssh = ssh -p 846 -i ~/.ssh/keys/academy -C [hooks] changegroup = hg update >&2
Now try updating your archive by typing:
you should see a response like this:
pulling from ssh://firstname.lastname@example.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://email@example.com/academy.2015/Web/naType "hg update", now you are successful.
searching for changes
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)
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