问题:在机器没有配置git ssh keys 的时候,会出现一个错误:
Permission denied (publickey). fatal: The remote end hung up unexpectedly
配置步骤如下
Step 1: Check for SSH keys
First, we need to check for existing ssh keys on your computer. Open up Terminal and run:
cd ~/.sshls# Lists the files in your .ssh directory
Check the directory listing to see if you have a file named either id_rsa.pub
or id_dsa.pub
. If you don't have either of those files go to step
2. Otherwise, you already have an existing keypair, and you can skip to step
3.
Step 2: Generate a new SSH key
To generate a new SSH key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter.
ssh-keygen -t rsa -C "your_email@example.com"# Creates a new ssh key, using the provided email as a label# Generating public/private rsa key pair.# Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]ssh-add id_rsa
Now you need to enter a passphrase.
Why do passphrases matter?
# Enter passphrase (empty for no passphrase): [Type a passphrase]# Enter same passphrase again: [Type passphrase again]
Which should give you something like this: