Install Git

  1. Sudo apt-get update gets a list of the most recent packages;
  2. sudo apt-get install git git-core git-gui git-doc git-svn git-cvs gitweb gitk git-email git-daemon-run git-el git-arch

2. Check SSH

  1. SSH -t [email protected] (this command generates the known_hosts file)
  2. Ok: Warning: Permanently added ‘github.com, 204.232.175.90’ (RSA) to the list of known hosts. Permission denied (publickey).

Install the SSH keys

  1. Check whether the well has SSH keys. If so, go to step 2; otherwise, go to step 3 CD ~/.ssh ls

Check whether SSH keys exist in the directory. The id_RSA (private key) and id_rsa.pub (public key) files were not found on my computer, so there is no need to perform the second step, backup and remove the existing SSH keys

  1. Back up and remove the existing SSH keys
mkdir key_backup
cp id_rsa* key_backup
rm id_rsa* 
Copy the code

Back up the existing id_rsa, id_rsa.pub files to the key_backup folder

  1. Run the following command (without SSH keys) :

Ssh-keygen -t rsa -c “Your own github email address” example: SSH -keygen -t rsa -c “[email protected]” (make sure ~/. SSH/has the known_hosts file before running the preceding command

Two files id_rsa (private key) and ID_rsa. pub (public key) were created

  1. Add the SSH keys you just created to Github

2. On GitHub, click Settings -> SSH Keys -> Add SSH Key. Copy in the string from the id_rsa.pub file without newlines or Spaces. Such as: Pub cat id_rsa.pub ssh-rsa exists in the ~/. SSH directory AAAAB3NzaC1yc2EAAAADAQABAAABAQCiCXUTL5AquJH00HQOn+nvEKof++JH99P2FNLSgLqyiwNAzO598zaiN/IYLfDz/wZjyDuGa/xerzy8funhSA5joCN2 UWISxz0DheAytfLX+KUpzE7hRV/Gy1vzPqLNM9Q1uSE/KFgSslCPsxEoceih870kjAGDDI4m9xZYBFL4osiWp5KEKSc/WCf6+POmjt8dhkIMAgw4X5LSZTlg k8D3KKx7QKhieck1GrjkEgbB2v57HHs/wCWEsWNdezZ7jYuSmG2V4ZLk0esO5u0kOeayNKaVv0HX3e5FXPZTycifybuetDmmc8m6i1jaVRgFEQb9Hjs9o4Sm WXyrTJzmpl/7 [email protected]

Note: do not copy the back of the mailbox, the front all copy OK

5. Run SSH -t [email protected] to check the SSH connection status (in ~ /. SSH)

If you see the following, you have added successfully: Github Hi chenWR2018! You’ve successfully authenticated, but GitHub does not provide shell access. If the preceding information is displayed, git SSH is successfully set

SSH keys are available on Github

Note 1: If you set a password when setting the public key, you are required to enter the password in this step. Therefore, enter the password that you set at that time. Note 2: After the above Settings, you can use SSH to access the GitHub hosting server directly with Git command

Configure Git

Git config –global user. Name “git config –global user. Email” git config –global user.name “chenwr2018” git config –global user.email “[email protected]

After this step, the Ubuntu14.04 git environment is set up successfully!