ssh is a very useful tool in your work, you can use this to connect to your develop environment or config you github.

check your existing public ssh key

the default ssh key is saved at the ~/.ssh directory, so before you start to use ssh, you need to check if you already has a public ssh key.

generate ssh key in you home

1. generate ssh key

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

2. start the ssh agent

eval "$(ssh-agent -s)"

3. add the ssh key to ssh agent

ssh-add ~/.ssh/id_rsa

4. test your ssh

ssh -T git@github.com

add the ssh key to your github

after you config the ssh to your github, it’s easy to push the code to your remote repository without input your user name and password every time.

1. head to the ssh directory

cd ~/.ssh/
ls .
cat *.pub

2. copy the key and add to your github ssh setting.

use the config file when you connecting the develop environment.

when you connect to your remote ssh develop environment, like aliyun or other ECS server, you will use the ssh. every time you need to input your remote address and the username, it’s not easy to remember the host address. so use the ssh config file will help you.

1. create the config file at .ssh directory

cd ~/.ssh/
touch config
vim config

2. add your remove host information to the config file.

Host dev_name
  HostName *.*.*.*
  User  username

...

3. now you can connect your ssh develop just use the command

ssh dev_name

Happy Coding.