search

Home  >  Q&A  >  body text

github - 在不同的地方使用同一个ssh私钥以便用git进行版本控制

就是我已经在一台电脑上产生了一对rsa公钥和私钥,并且将公钥添加到了git服务器 但是我现在想在另一台电脑上也使用这个git服务器的代码仓库 又不想重新生成rsa公钥和私钥 因为再上传新的公钥比较麻烦,那能不能把之前在第一台电脑上生成好的rsa私钥加载到我新的电脑上的git中,以进行版本控制呢,这个要如何加载呢 是直接拷贝过来吗? 具体又是拷贝到哪个路径呢? 貌似在google里没有搜到有用的信息

高洛峰高洛峰2798 days ago596

reply all(2)I'll reply

  • 迷茫

    迷茫2017-04-24 09:13:14

    If it is a Linux system (based on openssh), the public/private key is generally located at ~/.ssh 下的 id_rsaid_rsa.pub , just copy it to the corresponding location. If you are not Linux, please refer to the manual of each client.

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-24 09:13:14

    The specific parameter configuration is in the Gitetcsshssh_configssh_config file # IdentityFile ~/.ssh/id_rsa You can change the git default configuration, or you can create a new config file in the ~/.ssh/ directory, the content is as follows

    Host gitlab.xxx.com  
        IdentityFile ~/.ssh/mousycoder  
        User mousycoder

    reply
    0
  • Cancelreply