gpt4 book ai didi

git - Mercurial 和 Git 自定义 SSH key 位置

转载 作者:行者123 更新时间:2023-12-02 13:58:25 26 4
gpt4 key购买 nike

是否有任何方法可以为每个克隆的 repo 定义它应该使用哪个 SSH key 对的路径?

最佳答案

是的,您需要定义一个 ~/.ssh/config文件,您可以在其中声明不同的 ssh 名称,并为要使用的公钥/私钥自定义完整路径名。

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"

从那里,repo 的 ssh url 可以是:
AHostName:myrepo

也可以看看:
  • "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 - Mercurial 和 Git 自定义 SSH key 位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12668278/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com