# 一般github建repo都會配成這樣的remote
# git remote add origin git@github.com:<username>/<repo-name>.git
# push代碼的時侯會默認用./ssh/id_rsa和id_rsa.pub
git push origin master
# 如果你想用不同用戶和rsa key pair去提交代碼,你需要
# 1. 增加下面 ~/.ssh/config
Host github.com-user2
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_user2
# 2. 修改origin url
git remote rm origin
# 注意:這裡的hostname是github.com-user2,而不是github.com
git remote add origin git@github.com-user2:<username>/<repo-name>.git
``sh
网友评论