指定git clone使用特定的ssh key - jenhaoyang/backend_blog GitHub Wiki

新增 ~/.ssh/config

Host gitserv
    Hostname remote.server.com  #不要https
    IdentityFile ~/.ssh/id_rsa.github
    IdentitiesOnly yes # see NOTES below

網址使用剛剛設定的hostname

git remote add origin git@gitserv:myrepo.git

參考:
https://stackoverflow.com/a/11251797