मैंने दो GitHub खाते सेट किए हैं, लेकिन मुझे सही तरीके से काम करने के लिए ssh कुंजियाँ नहीं मिल सकती हैं। मैं विभिन्न विन्यास की कोशिश की है।
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
उपयोगकर्ता नाम 1 के लिए काम करता है:
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 username2 के रेपो में:
ERROR: Permission to username2/repo.git denied to username1.
fatal: The remote end hung up unexpectedly
मैंने भी और उसी के तहत git pushदोनों सेटिंग्स के साथ कोशिश की है । आउटपुट अंतिम कॉन्फ़िगरेशन के साथ ही है।IdentityFileUserHost
मुझे लगता है कि git स्वचालित रूप से Host "github.com" की खोज करता है क्योंकि रिमोट ऐसा है। यह कहा जाता है कि होस्ट कुछ भी आप चाहते हैं ( /programming//a/3828682 ) हो सकता है। क्या कोई तरीका है जो ssh config से होस्ट को विशिष्ट रेपो उपयोग के लिए बदलना चाहिए?
यह आदर्श होगा अगर मैं इसे सिर्फ ~ / .ssh / config से हल कर सकता हूं।
IdentitiesOnly=yesप्रत्येकhostअनुभाग पर जोड़ना होगा कि ssh केवल चुनी हुई पहचान फ़ाइल को लेगा और डिफ़ॉल्ट रूप से कुछ और प्रयास नहीं करेगा ..