1. ssh gen saved in ~/.ssh
~/.ssh/
-rw------- 1 lake lake 1743 Mar 2 10:02 id_rsa ==========> Private key
-rw-r--r-- 1 lake lake 401 Mar 2 10:02 id_rsa.pub ============> Public key
-rw-r--r-- 1 lake lake 9946 Mar 2 10:26 known_hosts =================> Know hosts public key files from the 3rd party
2. upload ssh public key into git server
~/.ssh/id_rsa.pub ======> github.com/yourname =====> Setting ===> SSH public key upload
3. Test
lake@lake-Latitude-5491:~$ chmod 600 .ssh/id_rsa
lake@lake-Latitude-5491:~$ ssh -vT git@github.com
OpenSSH_7.6p1 Ubuntu-4ubuntu0.1, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to github.com [52.74.223.119] port 22.
debug1: Connection established.
debug1: identity file /home/lake/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /home/lake/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/lake/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/lake/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/lake/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/lake/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/lake/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
...........................
...........
...........
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
Hi lakehu! You've successfully authenticated, but GitHub does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 3144, received 2228 bytes, in 7.7 seconds
Bytes per second: sent 410.3, received 290.7
debug1: Exit status 1
lake@lake-Latitude-5491:~$ ssh -T git@github.com
Enter passphrase for key '/home/lake/.ssh/id_rsa':
Hi lakehu! You've successfully authenticated, but GitHub does not provide shell access.
lake@lake-Latitude-5491:~$ git clone git@github.com:lakehu/example-code.git
Cloning into 'example-code'...
Enter passphrase for key '/home/lake/.ssh/id_rsa':
remote: Enumerating objects: 2437, done.
remote: Total 2437 (delta 0), reused 0 (delta 0), pack-reused 2437
Receiving objects: 100% (2437/2437), 4.87 MiB | 18.00 KiB/s, done.
Resolving deltas: 100% (765/765), done.