<<<<<<< local Installing Mercurial on Ubuntu

Installing Mercurial on Ubuntu

Mercurial is a free, distributed source control management tool. This tutorial covers how to install Mercurial on Ubuntu and clone the Fab Academy archive.

Note: Type or copy the code in the grey boxes line by line. After each line of code you type in - you need to hit the enter key.

Step 1: Install Mercurial and Dependencies

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...

start "Terminal" (starting programs in Ubuntu)

Type or copy the following line (copy paste in VirtualBox)

sudo apt-get install ssh 

Then to instal Mercurial - Type:
sudo apt-get install mercurial

You will have to enter your password, which is the same as your login password. You confirm with either Y or with the Enter-key.

Step 2: Key files

Start "firefox" (starting programs in Ubuntu)
Go to your webmail (googlemail, yahoo, msn...)
Find the E-mail I sent you.
Download academy and academy.pub one by one to your Downloads folder (~/Downloads).

Type:

mkdir ~/.ssh        
Note: If your "Downloads" or "Desktop"-folder is named differently (Escritorio, Ambiente de trabalho, рабочий стол...) substitute the proper name in the following explanations

The following step is only necessary if your academy private key was renamed by your OS to academy.txt, if not, skip.
mv ~/Downloads/academy.txt ~/Downloads/academy 

copy academy to .ssh

mv ~/Downloads/academy ~/.ssh
then type:
mv ~/Downloads/academy.pub ~/.ssh
to copy academy.pub to .ssh

Both keys are now located in the .ssh directory. You can check to see by typing: sudo ls -l ~/.ssh/ to list the contents of the directory. You should see that academy and academy.pub are listed.

Step 3: Permissions for the Private Key

You need to set permissions for your private key so that only you have read/write access to them.

Type:

sudo chmod 600 ~/.ssh/academy
Then type:
sudo chmod 644 ~/.ssh/academy.pub
Change path below to wherever you would like to store the archive (or leave on Desktop):
mkdir ~/Desktop/Archive

Step 5: Clone the archive

Now we need to clone our local Archive in Barcelona.

Copy the text below and paste it into the terminal:

hg clone -e "ssh -p 846 -i ~/.ssh/academy" ssh://hg@fabacademy.org/academy.node.barcelona ~/Desktop/Archive/

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
Note: The number of files listed varies with the number of files in archive. A folder named Archive has been created on your desktop. This folder contains the archive.

Step 6: Edit the Configuration File

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.

Copy and paste the following line to "gedit" (starting programs in Ubuntu).

Change to your name and email address, then paste the entire line into the terminal:

echo -en "\n\n[ui]\nusername = First Last <email@mit.edu>\nssh = ssh -i ~/.ssh/academy -C\n\n[extensions]\nconvert =\nfetch =\n\n[hooks]\n\nchangegroup = hg update >&2"  >> ~/Desktop/Archive/.hg/hgrc
    

So for example in my case it would look like this:

echo -en "\n\n[ui]\nusername = Ferdinand Meier <ferdi@fablabbcn.org>\nssh = ssh -i ~/.ssh/academy -C\n\n[extensions]\nconvert =\nfetch =\n\n[hooks]\n\nchangegroup = hg update >&2"  >> ~/Desktop/Archive/.hg/hgrc
    

Step 7: Update Your Archive

change to your Archive directory

cd ~/Desktop/Archive/

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.

Step 8: Update Your Website

In order to update your website you have to copy your files to the Archive and "push" them to the server.

Make sure that your site is inside a folder with your name. Take the name from the academy.org links (click on your name and copy the name of the folder: e.g. firstname_secondname.lastname). Check that there is a valid index.html (not Index.html or index.htm or index.HTML!!!) directly inside this folder.

Double check that you only upload allowed filetypes (only html, gif, jpeg, css and javascript!)
Make sure that your images are not much bigger than about 100kB in size!

If your Linux runs on virtualbox you might have to copy from the host to the guest-machine. Virtualbox filesharing

If you have a regular installation of Ubuntu, you can just copy the files from your windows/mac partition.

Use the file browser to copy your website to the Archive folder on your Desktop

Next thing to do is to open your Terminal and go to your Archive folder

cd ~/Desktop/Archive/
Then execute
hg pull
hg update
hg addremove
hg commit -m "meangingful message"
hg push

Never, ever, EVER use push -f to force. You will regret it.

Troubleshooting:

If you are asked for a password:
then Mercurial can't find the keys or the key file permissions are wrong. (see steps 2 & 3).

If you try to pull and you get this message:
remote: ssh: connect to host fabacademy.org port 22: Connection refused
abort: no suitable response from remote hg!

Then you forgot to edit the config file (see step 6)

Working With Mercurial

Look over the Mercurial basics and resources page.

Starting programs in Ubuntu

To start a program you can either click on the icon in the upper left corner (called Dash) or hit the CMD (Mac) or Win (Windows) key.
Then you can type the first letters of the program name and hit enter as soon as it appears first,
or select the icon with the mouse.

Copy paste in virtualbox

For the clipboard to work in virtualbox, you have to go to Machine --> Settings --> General --> Advanced and set Shared clipboard to "Bidirectional"
Then you can copy with Ctrl + c (windows) / Cmd + c (mac) and paste with Shift + Control + v (windows and mac) or rightclick --> paste.

Tutorial by Anna Kaziunas France adapted by Ferdinand Meier - Last Updated February , 9th 2015

======= Installing Mercurial on Ubuntu

Installing Mercurial on Ubuntu

Mercurial is a free, distributed source control management tool. This tutorial covers how to install Mercurial on Ubuntu and clone the Fab Academy archive.

Note: Type or copy the code in the grey boxes line by line. After each line of code you type in - you need to hit the enter key.

Step 1: Install Mercurial and Dependencies

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...

start "Terminal" (starting programs in Ubuntu)

Type or copy the following line (copy paste in VirtualBox)

sudo apt-get install ssh 

Then to instal Mercurial - Type:
sudo apt-get install mercurial

You will have to enter your password, which is the same as your login password. You confirm with either Y or with the Enter-key.

Step 2: Key files

Start "firefox" (starting programs in Ubuntu)
Go to your webmail (googlemail, yahoo, msn...)
Find the E-mail I sent you.
Download academy and academy.pub one by one to your Downloads folder (~/Downloads).

Type:

mkdir ~/.ssh        
Note: If your "Downloads" or "Desktop"-folder is named differently (Escritorio, Ambiente de trabalho, рабочий стол...) substitute the proper name in the following explanations

The following step is only necessary if your academy private key was renamed by your OS to academy.txt, if not, skip.
mv ~/Downloads/academy.txt ~/Downloads/academy 

copy academy to .ssh

mv ~/Downloads/academy ~/.ssh
then type:
mv ~/Downloads/academy.pub ~/.ssh
to copy academy.pub to .ssh

Both keys are now located in the .ssh directory. You can check to see by typing: sudo ls -l ~/.ssh/ to list the contents of the directory. You should see that academy and academy.pub are listed.

Step 3: Permissions for the Private Key

You need to set permissions for your private key so that only you have read/write access to them.

Type:

sudo chmod 600 ~/.ssh/academy
Then type:
sudo chmod 644 ~/.ssh/academy.pub
Change path below to wherever you would like to store the archive (or leave on Desktop):
mkdir ~/Desktop/Archive

Step 5: Clone the archive

Now we need to clone our local Archive in Barcelona.

Copy the text below and paste it into the terminal:

hg clone -e "ssh -p 846 -i ~/.ssh/academy" ssh://hg@fabacademy.org/academy.node.barcelona ~/Desktop/Archive/

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
Note: The number of files listed varies with the number of files in archive. A folder named Archive has been created on your desktop. This folder contains the archive.

Step 6: Edit the Configuration File

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.

Copy and paste the following line to "gedit" (starting programs in Ubuntu).

Change to your name and email address, then paste the entire line into the terminal:

echo -en "\n\n[ui]\nusername = First Last <email@mit.edu>\nssh = ssh -i ~/.ssh/academy -C\n\n[extensions]\nconvert =\nfetch =\n\n[hooks]\n\nchangegroup = hg update >&2"  >> ~/Desktop/Archive/.hg/hgrc
    

So for example in my case it would look like this:

echo -en "\n\n[ui]\nusername = Ferdinand Meier <ferdi@fablabbcn.org>\nssh = ssh -i ~/.ssh/academy -C\n\n[extensions]\nconvert =\nfetch =\n\n[hooks]\n\nchangegroup = hg update >&2"  >> ~/Desktop/Archive/.hg/hgrc
    

Step 7: Update Your Archive

change to your Archive directory

cd ~/Desktop/Archive/

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.

Step 8: Update Your Website

In order to update your website you have to copy your files to the Archive and "push" them to the server.

Make sure that your site is inside a folder with your name. Take the name from the academy.org links (click on your name and copy the name of the folder: e.g. firstname_secondname.lastname). Check that there is a valid index.html (not Index.html or index.htm or index.HTML!!!) directly inside this folder.

Double check that you only upload allowed filetypes (only html, gif, jpeg, css and javascript!)
Make sure that your images are not much bigger than about 100kB in size!

If your Linux runs on virtualbox you might have to copy from the host to the guest-machine. Virtualbox filesharing

If you have a regular installation of Ubuntu, you can just copy the files from your windows/mac partition.

Use the file browser to copy your website to the Archive folder on your Desktop

Next thing to do is to open your Terminal and go to your Archive folder

cd ~/Desktop/Archive/
Then execute
hg pull
hg update
hg addremove
hg commit -m "meangingful message"
hg push

Never, ever, EVER use push -f to force. You will regret it.

Troubleshooting:

If you are asked for a password:
then Mercurial can't find the keys or the key file permissions are wrong. (see steps 2 & 3).

If you try to pull and you get this message:
remote: ssh: connect to host fabacademy.org port 22: Connection refused
abort: no suitable response from remote hg!

Then you forgot to edit the config file (see step 6)

Working With Mercurial

Look over the Mercurial basics and resources page.

Starting programs in Ubuntu

To start a program you can either click on the icon in the upper left corner (called Dash) or hit the CMD (Mac) or Win (Windows) key.
Then you can type the first letters of the program name and hit enter as soon as it appears first,
or select the icon with the mouse.

Copy paste in virtualbox

For the clipboard to work in virtualbox, you have to go to Machine --> Settings --> General --> Advanced and set Shared clipboard to "Bidirectional"
Then you can copy with Ctrl + c (windows) / Cmd + c (mac) and paste with Shift + Control + v (windows and mac) or rightclick --> paste.

Tutorial by Anna Kaziunas France adapted by Ferdinand Meier - Last Updated February , 9th 2015

>>>>>>> other