2012-03-05 10 views
17

मुझे लगता है कि किसी अन्य (स्थानीय) भंडार से इसे दबाए जाने के बाद मुझे एक गिथब खाते में मेरी अनुमतियां खो दी हैं। अब मैं निम्नलिखित त्रुटि मिल रही है:अनुमतियां त्रुटि github (एसएसएच कुंजी पहचाना नहीं गया)

git push 
Permission denied (publickey).fatal: 
The remote end hung up unexpectedly 

मैं तो एक प्रमुख पुनर्जीवित करने के लिए निम्नलिखित कदम उठाए:

ssh-keygen 
Set up an ssh on my account for this laptop, using id_rsa.pub 

बहरहाल, यह असफल रहा था। जब मैं निम्नलिखित कोड का सुझाव देता हूं, तो मुझे निम्न त्रुटि मिलती है:

ssh-add -l 
Could not open a connection to your authentication agent. 

कोई विचार?

उत्तर

50

मैं इस समस्या का समाधान इस कदम निम्नलिखित आप इस लाइन /etc/rc.local में यदि आप लिनक्स के तहत कर रहे रख सकते हैं दर कदम निर्देश:

चरण 1: SSH कुंजियों के लिए चेक

$ cd ~/.ssh 
# Checks to see if there is a directory named ".ssh" in your user directory 
# If it says "No such file or directory" skip to step 3. Otherwise continue to step 2. 

चरण 2: बैकअप और हटाने मौजूदा SSH कुंजियों

$ ls 
# Lists all the subdirectories in the current directory 
# config id_rsa id_rsa.pub known_hosts 

$ mkdir key_backup 
# Makes a subdirectory called "key_backup" in the current directory 

$ cp id_rsa* key_backup 
# Copies the id_rsa keypair into key_backup 

$ rm id_rsa* 
# Deletes the id_rsa keypair 

चरण 3: नया SSH कुंजी जेनरेट करें

$ ssh-keygen -t rsa -C "[email protected]" 
# Creates a new ssh key using the provided email 

# Generating public/private rsa key pair. 
# Enter file in which to save the key (/home/you/.ssh/id_rsa):  
# Enter passphrase (empty for no passphrase): [Type a passphrase] 
# Enter same passphrase again: [Type passphrase again]  
# Your identification has been saved in /home/you/.ssh/id_rsa. 
# Your public key has been saved in /home/you/.ssh/id_rsa.pub. 
# The key fingerprint is: 
# 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db [email protected] 

चरण 4: GitHub

को आपकी SSH कुंजी जोड़ें
$ sudo apt-get install xclip 
# Downloads and installs xclip 

$ xclip -sel clip < ~/.ssh/id_rsa.pub 
# Copies the contents of the id_rsa.pub file to your clipboard 

फिर, hithub पर जाएँ, और कार्य करें: बाएं साइडबार में

  1. जाओ अपने खाते की सेटिंग्स
  2. पर क्लिक करें "SSH कुंजियों" करने के लिए
  3. "SSH कुंजी जोड़ें"
  4. में अपने प्रमुख चिपकाएं
  5. क्लिक करें "कुंजी" क्षेत्र
  6. क्लिक करें
  7. पुष्टि कार्रवाई अपने GitHub पासवर्ड दर्ज करके "कुंजी जोड़ें"

चरण 5: टेस्ट सब कुछ बाहर

$ ssh -T [email protected] 
# Attempts to ssh to github 

ठीक हैं, तो आप

Hi username! You've successfully authenticated, but GitHub does not 
# provide shell access. 

अन्यथा देखेंगे (यह मेरे साथ हुआ), तो आपको

Agent admitted failure to sign using the key. 
# debug1: No more authentication methods to try. 
# Permission denied (publickey). 

इस हल करने के लिए देखेंगे

$ ssh-add 
# Enter passphrase for /home/you/.ssh/id_rsa: [tippy tap] 
# Identity added: /home/you/.ssh/id_rsa (/home/you/.ssh/id_rsa) 

मूल जानकारी के लिए

https://help.github.com/articles/generating-ssh-keys

https://help.github.com/articles/error-agent-admitted-failure-to-sign

+0

ssh-add करता है बात। धन्यवाद फिर से ... –

+0

क्षमा करें, आप पथ कैसे इनपुट करते हैं? मेरा पथ सी है: \ दस्तावेज़ और सेटिंग्स \ admin \ .ssh फ़ोल्डर। पथ टाइप करने का प्रारूप क्या है? – Thinkerer

+0

'sudo apt-get install xclip' के बजाय अपने मैक पर आपको –

1

आप कमांड

ssh-copy-id [email protected] 

और ssh-agent अपने ssh-ऐड से पहले चलाना चाहिए के साथ सर्वर पर आपके कुंजी निर्यात करने की है।

eval $(ssh-agent) 

संपादित: अब मैं आपको विंडोज़ का उपयोग पता है इस सूत्र, तो देखें: Getting ssh-agent to work with git run from windows command shell

+0

टिप के लिए धन्यवाद एक $ ssh-add यह मेरे लिए काम किया हल करने करना - मैं Git-बैश उपयोग कर रहा हूँ विंडोज़ और एसएसएच-कॉपी-आईडी पर इंटरफ़ेस कमांड के रूप में पहचाना नहीं गया है। – mike

+0

तो, आपको जेनरेट लाइन को मैन्युअल रूप से 'id_rsa.pub' से कॉपी करना होगा और इसे' ~ user/.ssh/valid_keys' –

+0

फ़ाइल में सर्वर पर जोड़ना होगा ...;) –

3

आप पहले से ही ~/.ssh में एक सार्वजनिक कुंजी है (और पहले से ही जोड़ लिया है अपने GitHub खाते में महत्वपूर्ण यह है कि), आप केवल लोड करने के लिए हो सकता है यदि आपके फिर से एसएसएच एजेंट में कुंजी।

अगर SSH एजेंट कुंजी है, तो परिणाम है परीक्षण करने के लिए, टाइप करें ssh-add -l :

The agent has no identities. 

तो बस इस तरह SSH एजेंट में अपने कुंजी लोड:

ssh-add ~/.ssh/github_rsa 

(github_rsa संग्रहीत एसएसएच कुंजी के लिए मेरी मशीन पर नाम है। यह फ़ाइल दूसरों के बीच भी नामित की जा सकती है: id_rsa)

उसके बाद आपको वाई दर्ज करना होगा कुंजी के लिए हमारा पासफ्रेज (यह संभव है कि आपका पासवर्ड जिथब में लॉग इन हो)। आप इस प्रकार का संदेश मिलता है:

Identity added: /Users/name/.ssh/github_rsa (/Users/cpotzinger/.ssh/github_rsa) 
2

gitlab के लिए भी निम्नलिखित

jovimac-2:work joviano$ git clone [email protected]:bjetfweb.git 
Cloning into 'bjetfweb'... 
Access denied. 
fatal: Could not read from remote repository. 

Please make sure you have the correct access rights 
and the repository exists. 
+0

सरल और आसान। – workdreamer

संबंधित मुद्दे