Darcs can be run from the standard Windows command shell, cmd.exe, or from inside Cygwin. These two methods are slightly different due to differences in path names (drive letters, path separators).
Without Cygwin
Download the pre-packaged darcs and putty from
http://zooko.com/darcsdir-w32-1.0.5a.zip and unzip it. Let us refer to the resulting directory (including the path to it) as DARCSDIR.
Add DARCSDIR to the end of your path (Windows XP):
Right click on 'My Computer'.
Choose 'Properties'.
Click the 'Advanced' tab.
Click 'Environment variables'
Find the 'PATH' environment variable and choose to edit it.
Add ';DARCSDIR ' to the end of the 'PATH' environment variable.
Save and close the windows.
If you want to use darcs over ssh you need to set up passwordless ssh login. Darcs over ssh is required to push patches to a remote machine.
On
http://www.tartarus.org/~simon/puttydoc/Chapter8.html#C8 it is described how to generate a pair of keys.
Place the public key according to the guide and make sure the permissions are right.
To make ssh use your private key automatically (this is necessary since we are setting up passwordless ssh login) you need to start 'pageant'. Therefore:
Create a new shortcut in the 'Start -> All programs -> Startup' menu. (These programs are automatically executed on login.)
The shortcut shall execute ' DARCSDIR/pageant.exe PATH-TO-THE-PRIVATE-KEY'. Note that since PATH-TO-THE-PRIVATE-KEY may contains spaces, it may be necessary to put quotes around it. It never hurts to put quotes around it.
Log out and log in again to check that 'pageant' automatically starts up.
Check that the key is loaded: double click the icon in the system tray. If there is listed one key, it should be fine. If no keys are listed, check the shortcut.
If everything went well, the final check is executing "ssh USERNAME@HOST". If you get logged into the host you are done. If you are asked to enter your password then it is not working. Double-check that 'pageant' is started and the key is loaded, then go back through this process to figure out what went wrong.
With Cygwin
Download the pre-packaged darcs and putty from
http://zooko.com/darcsdir-cygwin-1.0.5a.tar.bz2 and untar it.
Add the resulting "darcsdir" directory to the end of your path.
If you want to use darcs over ssh you need to set up passwordless ssh login. Darcs over ssh is required to push patches to a remote machine. Note that you have to set up a new ssh configuation using the putty executables in the darcsdir directory -- darcs will not use cygwin ssh nor your current cygwin ssh configuration.
On
http://www.tartarus.org/~simon/puttydoc/Chapter8.html#C8 it is described how to generate a pair of keys.
Place the public key according to the guide and make sure the permissions are right.
To make ssh use your private key automatically (this is necessary since we are setting up passwordless ssh login) you need to start 'pageant.exe', passing the path to the private key as the argument to pageant.exe.
Check that the key is loaded: double click the icon in the system tray. If there is listed one key, it should be fine. If no keys are listed, check the shortcut.
If everything went well, the final check is executing "darcsdir/ssh.exe USERNAME@HOST" (note: this is the putty ssh executable that came in the darcsdir-cygwin.tar.bz2 package, not your normal cygwin ssh, which is usually found in /usr/bin/ssh.exe). If you get logged into the host you are done. If you are asked to enter your password then it is not working. Double-check that 'pageant' is started and the key is loaded, then go back through this process to figure out what went wrong.
The Manual Process -- try this if you want a newer version of darcs than the pre-packaged version supplied above
The basics (with or without Cygwin):
Download the latest darcs win32 binary from
http://glozer.net/darcs/
Pushing patches to a remote server requires a SSH implementation such as putty http://www.chiark.greenend.org.uk/~sgtatham/putty/ which supports both SCP and SFTP. Interactive password prompting will not work because the SSH clients are executed by darcs, so public key (AKA passwordless) authentication must be configured. For a putty-oriented tutorial see
http://www.tartarus.org/~simon/puttydoc/Chapter8.html#C8.
To enable access of remote repositories over ssh (with or without Cygwin, if you want to use ssh):
Download pagent.exe, puttygen.exe, plink.exe, sftp.exe, and pscp.exe from
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Put darcs.exe, plink.exe, pscp.exe, sftp.exe, pagent.exe, and puttygen.exe in an empty directory.
Rename plink.exe to ssh.exe and pscp.exe to scp.exe. Ensure that all these .exe files have permissions that allow you to execute them. If you are using cygwin, you can use "chmod ugo+x FILENAME" to enable execute permissions for each file.
Set up passwordless ssh login as described on this page:
http://www.tartarus.org/~simon/puttydoc/Chapter8.html#C8
Finally (without Cygwin):
Add the directory where you stored the executables at the beginning of your path.
Finally (with Cygwin):
Download
cygwin-wrapper.bash, a cygwin bash script; put it in /usr/local/darcsdir-cygwin (directory as seen by cygwin), put all of the ssh .exe's mentioned above into the same directory. Rename the darcs.exe to "realdarcs.exe". Rename cygwin-wrapper.bash to "darcs". Add /usr/local/darcsdir-cygwin to the end of your path. Don't put /usr/local/darcsdir-cygwin at the beginning, because that directory contains executables such as "ssh.exe" which you probably don't want to execute when you execute "ssh" on the bash command-line. Make sure you don't have any other "darcs" executables earlier in your path. (Hint: enter the commands "type darcs" and "type ssh" at the bash command-line.)
Solving problems with SSH
(This section entitled "Solving problems with SSH" is someone else's version of the same sort of hack described in the item above entitled "Finally (with Cygwin)".) (I had some problems with darcs push via SSH, so I decided to write this paragraph - maybe it will help someone)
For some reason, putting PuTTY's renamed files in darcs directory didn't work in my case. Firstly, I kept getting Host key verification failed error. It turned out that win32 darcs tried using Cygwin's ssh instead the one from PuTTY. Disabling ssh command from Cygwin gave me another error message: sh: /usr/bin/ssh: No such file or directory. This is when I realized darcs didn't want to use ssh.exe located in its directory. After some research I found a solution:
Put plink.exe, pscp.exe, sftp.zip, pagent.exe, and puttygen.exe in any directory you like, extract sftp.exe.
Set environment variables:
DARCS_SSH = x:\path\to\plink.exe
DARCS_SCP = x:\path\to\pscp.exe
DARCS_SFTP = x:\path\to\sftp.exe
If your path contains spaces, you may experience problems (Darcs reports that it cannot find the command "C:\Program", for example). A work-around is to make sure that the commands are found through the %PATH% variable, and then you can set the commands without their paths:
set PATH=%PATH%;C:\Program Files\PuTTY
set DARCS_SSH=plink.exe
set DARCS_SCP=pscp.exe
set DARCS_SFTP=psftp.exe
Note that I am using the normal PuTTY installation in this last example.
Also remember that Windows does not use account names the same way as Windows. Your repository is therefore going to look like this: username@hostname:path