Mercurial and Git custom SSH key location

前端 未结 1 1178
耶瑟儿~
耶瑟儿~ 2021-01-21 12:18

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

相关标签:
1条回答
  • 2021-01-21 13:13

    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:

    AHostName:myrepo
    

    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?"
    0 讨论(0)
提交回复
热议问题