コンピューター上で両方のgithubのアカウントを使用する方法

gitのグローバル設定をキャンセル

git config --global --unset user.name
git config --global --unset user.email

.ssh / configに設定

# zhangsan
Host zhangsan   #前缀名可以任意设置
HostName github.com
User git
IdentityFile ~/.ssh/zhangsan #密钥

# lisi
Host lisi  #前缀名可以任意设置
HostName github.com
User git
IdentityFile ~/.ssh/lisi #密钥

テストのSSH接続

ssh -T [email protected]
ssh -T [email protected]

コードを引っ張ります

場合は、同じ名前を持つユーザ名config設定ファイルに注意してください。

git clone git@zhangsan:zhangsan/zhangsan-docs.git 
git clone git@lisi:lisi/lisi-docs.git   

倉庫内ここで各セットのユーザ名

Zhangsanディレクトリ

git config user.name "zhangsan"
git config user.email "[email protected]"

リージディレクトリ

git config user.name "lisi"
git config user.email "[email protected]"

次に、あなたが正常に使用することができます

おすすめ

転載: www.cnblogs.com/syavingcs/p/12050556.html