1. Prepare ssh-copy-id
brew install ssh-copy-id
2. Generate private key and public key
ssh-keygen -t rsa -b 1024
3. Upload the public key to the server (~/.ssh/authorized_keys)
ssh-copy-id -i public key [email protected]
4. Add in the local ~/.ssh/config file (if not, create a new one)
Host git.oschina.net
IdentityFile ~/.ssh/weiwei.sun
Host 192.168.50.100
IdentityFile ~/.ssh/weiwei.sun