Mercurial: Difference between revisions
Line 63: | Line 63: | ||
[paths] | [paths] | ||
default: = ssh://hg@fab.cba.mit.edu/academy | default: = ssh://hg@fab.cba.mit.edu/academy | ||
[ui] | [ui] | ||
username = First Last <user@machine.domain> | username = First Last <user@machine.domain> |
Revision as of 11:05, 3 February 2011
Mercurial is a free, distributed source control management tool. It efficiently handles projects of any size and offers an easy and intuitive interface.
- http://fab.cba.mit.edu/classes/MIT/863.10/people/kenny.cheung/hgNotes.html, which this is mostly built on.
Mercurial on Ubuntu
Step 1: Install
Install .ssh
sudo apt-get install ssh
Download the academy and academy.pub files to your .ssh folder.
Linux packages
sudo apt-get install mercurial tortoisehg tortoisehg-nautilus
install Mercurial
sudo apt-get install mercurial
Step 2: Key files
put key files (academy and academy.pub) somewhere, probably in ~/.ssh/keys/ (you might want to create this keys directory) note that directories that start with a "." may be automatically hidden by your filesystem, you can see them by typing ls -a example: use the terminal and create a folder called .ssh in the home directory, then within the new .ssh directory create another directory called keys download the (academy and academy.pub) files and place them in the keys directory (you will have to either enable hidden folders, or do this all through the terminal)
sudo mkdir ~/.ssh/keys
Open the directory where the key files where downloaded to and move them to .ssh/keys directory
sudo mv academy ~/.ssh/keys sudo mv academy.pub ~/.ssh/keys
Step 3: Permissions for the private key
set permissions for your private key so that only the user has read/write access (i.e. sudo chmod go-rw ~/.ssh/keys/academy) your private key permissions could be rw-------, and your public key and config file permissions could be rw-r--r--
~/.ssh/keys$ sudo chmod go-rw academy ~/.ssh/keys$ sudo chmod go-rw-r--r-- academy.pub
Step 4: Setting the port
step 4: set the port that ssh uses to access fab.cba.mit.edu, by appending the following lines to ~/.ssh/keys/config (you might have to create ~/.ssh/keys/config, which is a text file with unix line endings and no .txt extension)
~/.ssh/keys$sudo gedit config
Write this in the config file and save:
host fab.cba.mit.edu port 846
Step 5 Clone the archive
- go to where you want the archive to be in your filesystem, and clone the archive
- note that local_archive_name will be a directory with the archive inside it
- ssh_path is the ssh application, including the path, if necessary
Copy the text (after $ )to the terminal:
~/Documents/FabAcademy$ hg clone -e "ssh -p 846 -i ~/.ssh/keys/academy" ssh://hg@fab.cba.mit.edu/academy academy
Step 6
- append the following your archive's personal configuration file, .hg/hgrc with any text editor
- (the .hg directory is in the fabClassArchive directory, and is a text file with unix line endings and no .txt extension)
~/Documents/FabAcademy/academy$ sudo gedit .hg/hgrc
Put this text in the file
[paths] default: = ssh://hg@fab.cba.mit.edu/academy [ui] username = First Last <user@machine.domain> ssh = ssh -p 846 -i ~/.ssh/keys/academy -C [hooks] changegroup = hg update >&2
Step 7
try updating your archive by typing:
~/Documents/FabAcademy/academy$ hg pull
you should see a response like this:
- pulling from ssh://hg@fab.cba.mit.edu/academy
- searching for changes
- no changes found
if it asks for a password, then it can’t find the key or the key file permissions make it not look like a key (see step 3) if it says something about port 22, then it can't find the config file (see step 4)
To open Mercurial
- To get all changes from another repository into the current one
~/Documents/FabAcademy/academy$ hg pull
- Add new files
hg add
- Commit changes
hg commit -m 'MESSAGE'
Push files to server
hg push
And also
Work in process.... to be editied
]