Use ssh-copy-id to upload public key on mac to log in without entering password

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

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326773372&siteId=291194637