Mercurial in Windows :
Here are the steps:
I installed Cygwin following these steps:
- Click on Setup.exe, then click "run" , and then "Next".
- I use "Install from Internet" and then "next" , select "All Users" depend of you and then "next", again "next" , select "Direct Connection" and "next" .
- Choose a Download Site, I chose "ftp://mirrors.kernel.org", but you can choose what ever you want, and then "next".
- Select Packages, in this parte I recommend you to choose "All", you have to click on "Default"(right side of the word "All"), and then "next".
- Take a break here, because it may take a while depending on the package and your internet connection.
You can install Cygwin following these steps too: ( recommended for fabacademy´s people)
- It´s almost the same, the diference is about "Select Packages".
- In "Select Packages", Select the following from the package selection windows; openssh, tcp_wrappers, and zlib. You may resize the windows for package details and click the little View button for "Full" view. Click on the plus sign to expand the categories. Select the package by clicking on the word "skip" so that an x appears in Column B. Install at least the following list of packages.
- From Admin , select all packages.
- From Archive , select unzip and zip packages.
- From Base , leave the default, select all packages.
- From Doc , leave the default, man and 'cygwin doc' packages.
- From Editors , select vim package.
- From Libs , select zlib package.
- From Net , select openssh , rsync , tcp_wrappers .
- Click Next to start installing Cygwin and ssh.
- Take a break here, because it may take a while depending on the package and your internet connection.
The following is very important to use Cygwin: ( You have to configure SSH, if you learn more about it check in what is SSH )
- Right click My Computer > Properties > Advanced > Environment Variables . Under System variables , click the [New] button to and add the follow values in the new entry.
- Variable name: CYGWIN
- Variable value: ntsec tty
- Right click My Computer > Properties > Advanced > Environment Variables . Under System variables , select the Path variable and click the [Edit] button. Append the following to the end of the existing variable string.
- Open a Cygwin window [Start] > Programs > Cygwin > Cygwin ; a black screen pops open; type
ssh-host-config .
- When the script asks you about "privilege separation", answer yes
- When the script asks about "create local user sshd", answer yes
- When the script asks you about "install sshd as a service", answer yes
- When the script stops and asks you for "CYGWIN=" your answer is ntsec tty
- From Cygwin terminal window (black screen), start the sshd service
- net start sshd
- or cygrunsrv --start sshd
Test your ssh connection:
- Let's test our sshd installation. Open a Cygwin terminal window (note: the commands below are case sensitive)
- whoami
- ssh localhost
- ssh -vvv localhost
- ssh "$USERNAME@127.0.0.1"t
- If you get a prompt without error messages, type
- if you see a directory listing, success! Type exit to end the cygwin ssh session.
Now we create our repository:
- Download the two key files (863.10 and 863.10.pub) from the email and save them somewhere you will remember them, like the Desktop.( I recommend you the "Desktop")
- You have to write the following on Cygwin:
- mkdir ~/.ssh + "enter" // create a directory
- mkdir ~/.ssh/keys + "enter" // create a directory
- cd /cygdrive/c/Users/<you username>/Desktop + "enter" // To go into a specific directory (in this case the Desktop where the keys are)
- cp academy ~/.ssh/keys + "enter" //copy the key academy to the created directory
- cp academy.pub ~/.ssh/keys + "enter" //copy the key academy to the created directory
- cd + "enter" // go to the general directory
- ~/.ssh/keys + "enter" // go to the specific directory
- chmod go-rw academy + "enter" // set permissions for your private key so that only the user has read/write access
- chmod go-rw-r--r--r academy.pub + "enter" // set permissions for your private key so that only the user has read/write access
- vim ~/.ssh/keys/config + "enter" // To create and edit that file (the file "keys")
- Once inside vim, type the letter 'i' to enter "insert mode", Now type these two lines:
- host fab.cba.mit.edu
- port 846
- To save and close the file, hit the esc key to exit insert mode, enter ':' to enter command mode, enter wq to "write" and "quit," and then hit enter:
- sequence is: [esc] [ : ] [w] [q] [enter]
Clone repository :
- create a directory(the name what you want e.g "fabacademy") on the Desktop.
- write the following on Cygwin :
- cd /cygdrive/c/Users/<your username>/Desktop/fabacademy + "enter" // go to the specific directory
- mkdir academy + "enter" // create a dircetory(called academy, but you choose how to call, into fabacademy directory)
- hg clone -e "ssh -p 846 -i ~/.ssh/keys/academy" ssh://hg@fab.cba.mit.edu/academy.2012 academy + "enter"
- cd /cygdrive/c/Users/<your username>/Desktop/fabacademy/academy + "enter"
- vim .hg/hgrc + "enter" // To create and edit that file
- Put this text in the file
- [ui] username = First Last <user@machine.domain> + "enter"
- ssh = ssh -p 846 -i ~/.ssh/keys/academy -C + "enter"
- [hooks] + "enter"
- changegroup = hg update >&2 + "enter"
- [esc] [ : ] [w] [q] [enter] + "enter"
- cd /cygdrive/c/Users/<your username>/Desktop/fabacademy/academy/Web/labs/<your lab>/people + "enter"
- mkdir lastname.firstname + "enter"
- hg pull + "enter"
- hg add + "enter" // adding files (before to write this on Cygwin you have to copy the files of your website into lastname.firstname directory)
- hg commit -m 'MESSAGE' + "enter"
- hg push + "enter" // upload to the repository.