ssh 多文件 多站点配置

  1. 进入ssh 目录:
  2. 生成新keys 并输入要生成的文件名 如leaf-go
  3. 将配置文件添加到ssh
  4. 创建config文件
# 配置文件
Host leaf.github.com
  HostName github.com
  IdentityFile ~/.ssh/leaf-go
  User [email protected]

Host leaf1.github.com
  HostName github.com
  IdentityFile ~/.ssh/leaf-go1
  User [email protected]
  1. 测试 ,

  2. 进入项目的.git目录找到config文件

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = true
[remote "origin"]
        #在这里把原来的地址替换成ssh config设置的host地址即可
        url = [email protected]:xxx/x.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
        remote = origin
        merge = refs/heads/main
[user]
        email = [email protected]

你可能感兴趣的:(ssh 多文件 多站点配置)