Mercurial and Git custom SSH key location

Exists there any way to define for each cloned repo the path of which SSH key pair it should use?

  • Database Schema Migration on Azure with Git Deployment
  • git-svn clone or svn2git unexpectedly stopping
  • How do I export OpenVMS CMS history and import it to GIT
  • SSHing shows wrong/old SSH key
  • git - remote add origin vs remote set-url origin
  • Maintaining a changelog.txt file in a DVCS
  • What is the best way to write a git update hook that rejects invalid submodule commits?
  • Checkout path is not empty. Do you want to delete its contents? Xamarin/Git
  • Show which git tag you are on?
  • Get error message ''fatal: sha1 information is lacking or useless“ when apply a patch using ”git am -3"
  • GitHub does not let me access Subfolders
  • Remove old remote branches from Git
  • One Solution collect form web for “Mercurial and Git custom SSH key location”

    Yes, you need to define a ~/.ssh/config file, in which you can declare different ssh names, with a custom full path name for the public/private key to use.

    Host AHostName -- name you will use for the ssh address
    User gituser
    Hostname SSH IP address 
    Port 1234 -- use this if you need custom ports
    IdentityFile "path to your private ssh key"

    From there, the ssh url of the repo can be:


    See also:

    • “git + assembla + multiple ssh keys/multiple computers”
    • “How to work on personal GitHub repo from office computer whose SSH key is already added to a work related GitHub account?”
    Git Baby is a git and github fan, let's start git clone.