7 August 2012

How to get Bazaar working with Launchpad in Windows & without any errors

Launchpad is a cool website that provide hosting services for open source projects. In order to work in launchpad hosted project you need an SSH key and a tool for SSH connection establishment. Such tool is not well integrated in WINDOWS as Linux platform. Fortunately, this tool exists and they are free & open source too :).

First step is that we need to generate an SSH key using a tool called putty (download the windows installer). After installation run puttygen.exe and click the generate button. PUTTYGEN will ask you to move your mouse around in the blank area to generate the key. Set your key pass-phrase. Click "Save public key" and choose a location to save it as filename.pub. Click "Save private key" and choose a secure location to save it as filename.ppk. Do not close Puttygen window just yet! Copy the public key from the Puttygen window then go to Launchpad page for adding the public key (the url look like https://launchpad.net/~USERNAME/+editsshkeys). Paste your SSH key under Add an SSH key.

Second step is to define certain environment variables. The first variable is BZR_SSH=plink as the following (pic-01)
pic-01: BZR_SSH=plink

. The second variable is to modify the PATH and to add the following line C:\Program Files\PuTTY; which will help Windows to locate the plink.exe program & to make it accessible via command prompt. The third variable is to create the ssh folder under the following path C:\Users\< username >\ by right clicking the directory & choosing New->Folder then type the name as '.ssh.' to get the folder as .ssh after that copy the public key then paste it in a text file named id_rsa.pub and save the file into the .ssh folder.

Third step is to establish the connection using Pageant. So Run Pageant aand make sure Pageant is running and RT+click the icon in the notification area. Add the private key you saved earlier (filename.ppk). This step is crucial if you want to connect to launchpad from a Windows PC.

Now you can use a tool like Tortoisebzr to push to Launchpad and avoid errors like 'bzr ERROR [Error 2] The system cannot find the file specified'