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?

  • I need a Git hook to sync MySql schema
  • Git granularity — resolving diffs within a line
  • Is it possible to get the time/date of a commit knowing the commit hash but without access to the repository?
  • Tracking branches in bare git repository?
  • Deriving application build version from `git describe` - how to get a relatively straightforward string?
  • How can I transform a remote none-bare repos to a bare reopos without re-clone in local machine in git?
  • GIt Config Alias With Quotes and Pipes via Command Line
  • Is it possible to pull just one file in Git?
  • Github Desktop - Not showing changes
  • In Git, is there a way to mark a file as “pure”?
  • src refspec ~ does not match any
  • Workflow for maintaining different versions of a webapp using 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.