# 为第一个账号生成密钥
ssh-keygen -t ed25519 -C "your_email1@example.com" -f ~/.ssh/id_ed25519_account1
# 为第二个账号生成密钥
ssh-keygen -t ed25519 -C "your_email2@example.com" -f ~/.ssh/id_ed25519_account2
# 第一个 GitHub 账号
Host github.com-account1HostName github.comUser gitIdentityFile ~/.ssh/id_ed25519_account1IdentitiesOnly yes
# 第二个 GitHub 账号
Host github.com-account2HostName github.comUser gitIdentityFile ~/.ssh/id_ed25519_account2IdentitiesOnly yes
# 进入第一个仓库
cd /path/to/repo1 git config user.name "chat0515" git config user.email "chat50897@gmail.com"
# 第一个仓库使用 account1
git remote set-url origin git@github.com-account1:YourName1/repository.git
# 测试连接
ssh -T git@github.com-account1
ssh -T git@github.com-account2