tôi giải quyết vấn đề này sau bước- này từng bước hướng dẫn:
bước 1: Kiểm tra cho các phím 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.
Bước 2: Sao lưu và loại bỏ những khóa SSH hiện
$ 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
Bước 3: Tạo một SSH mới chính
$ 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]
Bước 4: Thêm chìa khóa SSH của bạn để GitHub
$ 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
Sau đó, đi đến hithub, và làm:
- Đến Cài đặt tài khoản
- Bấm "SSH Keys" trong thanh bên trái
- Bấm "Add chìa khóa SSH"
- Dán chìa khóa của bạn vào "Key" lĩnh vực
- Bấm "Add chìa khóa"
- Xác nhận hành động bằng cách nhập mật khẩu của bạn GitHub
Bước 5: Kiểm tra tất cả mọi thứ ra
$ ssh -T [email protected]
# Attempts to ssh to github
Nếu ok, bạn sẽ thấy
Hi username! You've successfully authenticated, but GitHub does not
# provide shell access.
Nếu không (nó đã xảy ra với tôi), bạn sẽ thấy
Agent admitted failure to sign using the key.
# debug1: No more authentication methods to try.
# Permission denied (publickey).
Để giải quyết việc này
$ ssh-add
# Enter passphrase for /home/you/.ssh/id_rsa: [tippy tap]
# Identity added: /home/you/.ssh/id_rsa (/home/you/.ssh/id_rsa)
Đối với thông tin ban đầu
https://help.github.com/articles/generating-ssh-keys
https://help.github.com/articles/error-agent-admitted-failure-to-sign
ssh-add không điều. Cảm ơn một lần nữa ... –
xin lỗi, làm thế nào để bạn nhập vào đường dẫn? đường dẫn của tôi là C: \ Documents and Settings \ admin \ .ssh thư mục. định dạng nhập đường dẫn là gì? – Thinkerer
trên mac của bạn thay vì 'sudo apt-get install xclip' bạn có thể phải chạy 'brew install homebrew/emacs/xclip-mode' thay vì –