FaqHgSSH
How do I set up SSH with Mercurial?
Mercurial with the ssh:// access method type is one of the protocols supported in NetBeans that calls for valid settings in the mercurial config file. This file is located at:
- Windows systems: %USERPROFILE%\Mercurial.ini or <mercurial_installation_directory>\Mercurial.ini
- Unix systems, including Macintosh: $HOME/.hgrc>
Open this file and edit the ui section:
- Windows:
# with the use of private key authentication ssh = plink.exe -l <username> -i D:/new_my_private_key.ppk # or with password authentication ssh = plink.exe -l <username> -pw password
Putty applications can be downloaded as binaries from the following page: http://www.chiark.greenend.org.uk/sgtatham/putty/download.html
- Unix-like systems:
ssh = ssh -l <username> -i identy_file
SSH password-caching tools can help if SSH is repeatedly asking for the password. SSH password-caching tools include Pageant (as a part of Putty applications) on Windows and ssh-agent on Unix-like systems. If a key was generated along with the PassPhrase, you have to use the "ssh password-caching" tool.
- Windows:
- Modify the ui section of the Mercurial.ini file:
ssh = plink -l <username>
- Download and start the Pageant tool. (It is displayed in the system tray).
- Open it and add the key. You will be prompted for the PassPhrase.
- Modify the ui section of the Mercurial.ini file:
- Unix-like systems:
- Modify the ui section of the ~/.hgrc file: //
ssh = ssh -l <username>
- Run
ssh-agent in terminal
. This will print variables that should be set and exported (SSH_AUTH_SOCK, SSH_AGENT_PID). - Export all variables generated by the ssh-agent.
- Run
ssh-add /path_to_indentity_file
- Start NetBeans IDE from the same terminal.
- Modify the ui section of the ~/.hgrc file: //
Tunneling SSH through a Proxy:
This section describes how to tunnel through an http-proxy server without any server-side modifications.
- Windows:
- Start Putty application.
- Select the Connection | Proxy item. Set required Proxy type and fill Proxy hostname, Port. (If the proxy server asks for authentication, fill in a valid Username and Password)
- Now select Session item again and enter the session name into Saved Sessions field. (session name must match the hostname of the mercurial repository. For example: for the Repository URL https://peterp.org/hgrepo the session name has to be peterp.org)
- Save the session.
- Unix-like systems:
- Download and extract corkscrew.
- In the corkscrew directory type: ./configure, make and make install
- Add a new line to your ~/.ssh/config
#relplace the http proxy and port settings with the correct values ProxyCommand /usr/local/bin/corkscrew proxy.example.com 8080 %h %p