标签:
SSH keys are a way to identify trusted computers, without involving passwords. Most git servers choose SSH keys to authorize clients.
check for existing SSH keys on your computer.
$ ls -al ~/.ssh# Lists the files in your .ssh directory, if they exist
Check the directory listing to see if you already have a public SSH key. By default, the filenames of the public keys are one of the following:
1) Creates a new ssh key, using the provided email as a label
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
2) We strongly suggest keeping the default settings as they are, so when you‘re prompted to "Enter a file in which to save the key", just press Enter to continue.
Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
3) We strongly recommend a very good, secure passphrase.
Enter passphrase (empty for no passphrase): [Type a passphrase] Enter same passphrase again: [Type passphrase again]
4) After you enter a passphrase, review the fingerprint, or id, of your SSH key.
Add the content of id_dsa.pub to the end of sever’s authorized_keys
echo ‘the content of id_dsa.pub’ >> ~/.ssh/authorized_keys
Edit ssh configuration file ‘~/.ssh/config’.
Host servername HostName 192.168.3.1 User Admin IdentityFile ~/.ssh/id_rsa CompressionLevel 6
Now you can test the ssh connection
ssh servername
标签:
原文地址:http://www.cnblogs.com/luckysimple/p/5105089.html