Git and SSH, which key is used?

后端 未结 7 1929
暗喜
暗喜 2021-01-29 23:57

Say your .ssh directory contains 30 keys (15 private and 15 public).

Where in Git can one check which one is used to connect to a given remote repository?

7条回答
  •  失恋的感觉
    2021-01-30 00:38

    The following entry in .ssh/config file solves the problem

      host git.assembla.com
      user git
      identityfile ~/.ssh/whatever
    

    Where ~/.ssh/whatever is a path to your private key

    Additionally, user and host can be picked up from

    git push git@git.assembla.com:repo_name.git
             ^__ ^_______________
             user host
    

提交回复
热议问题