İki GitHub hesabı açtım, ancak ssh anahtarlarının doğru çalışmasını sağlayamıyorum. Çeşitli yapılandırmaları denedim.
Host github_username1
HostName github.com
IdentityFile ~/.ssh/rsa_1
User username1
Host github_username2
HostName github.com
IdentityFile ~/.ssh/rsa_2
User username2
git push:
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
Kullanıcı adı1 için çalışır:
Host github.com
HostName github.com
IdentityFile ~/.ssh/rsa_1
User username1
Host github.com
HostName github.com
IdentityFile ~/.ssh/rsa_2
User username2
git push kullaniciadi2'nin deposunda:
ERROR: Permission to username2/repo.git denied to username1.
fatal: The remote end hung up unexpectedly
Ben de denedim git pushikisi ile IdentityFileve Useraynı bölümündeki ayarları Host. Çıkış, son yapılandırma ile aynıdır.
Uzaktan böyle olduğu için git otomatik olarak "github.com" sunucusunu arar. Host'un istediğin herhangi bir şey olabileceği söyleniyor ( /programming//a/3828682 ). Belirli bir repo'nun kullanması gereken hangi ssh config sunucusundan değiştirmenin bir yolu var mı?
Bunu sadece ~ / .ssh / config dosyasından çözebilseydim ideal olurdu.
IdentitiesOnly=yeshost