Like the above commands, many Linux users will tell you that Git is not installed and how to install Git. First, you can try to enter
gitCheck whether the system has installed Git.
$ gitThe program 'git' is currently not installed. You can install it by typing:sudo apt-get install git
Like the above
CommandMany Linux users will tell you how to install Git if Git is not installed.
If you happen to use Debian or Ubuntu Linuxsudo apt-get install gitYou can directly install Git, which is very simple.
For other Linux versions, you can directly install them through the source code. Download the source code from the Git official website, decompress it, and enter the following in sequence:./config,make,sudo make installInstall these commands.
After the installation is complete, you also need to set the last step. In the command line, enter:
$ git config --global user.name "Your Name"$ git config --global user.email "email@example.com"
Then we need to configure SSH.
Step 2: Create an SSH Key. In the user's main directory, check whether there is a. ssh directory. If so, check whether there is a. ssh directory.
id_rsaAnd
id_rsa.pubIf you already have these two files, you can directly jump to the next step. If no, Open Shell (Open Git Bash in Windows) and create an SSH Key:
$ ssh-keygen -t rsa -C "youremail@example.com"
You need to replace the email address with your own email address and press enter to use the default value. Because this Key is not used for military purposes, you do not need to set a password.
If everything goes well, you can find it in the user's home directory.sshDirectory, which containsid_rsaAndid_rsa.pubTwo files, which are the Key pair of the SSH Key,id_rsaIt is a private key and cannot be disclosed,id_rsa.pubIt is a public key. You can tell anyone with confidence.
Step 2: log onto GitHub and open the "Account settings" and "SSH Keys" pages:
Click "Add SSH Key", fill in any Title, and paste it in the Key text box.
id_rsa.pubFile Content:
Click "Add Key" to view the added Key:
Why does GitHub need an SSH Key? Because GitHub needs to identify that the submission you push is indeed pushed by you, rather than impersonating others, and Git supports the SSH protocol, GitHub only needs to know your public key, you can confirm that only you can push.
Of course, GitHub allows you to add multiple keys. Assume that you have several computers. If you submit them at the company and submit them at home later, you only need to add the keys of each computer to GitHub, you can push data to GitHub on each computer.
Now, according to the GitHub promptlearngitRun the following command in the repository:
$ git remote add origin git@github.com:cqcre/cqc.git
Please note that you should replace the above cqcret with your GitHub account name. Otherwise, you are locally associated with my remote database, and there is no problem with the Association, but you cannot push it in the future, because your SSH Key public Key is not in my account list.
The remote database name isoriginThis is the default Git name. You can also change it to something else,originThis name is known as a remote database.
Next, you can push all the content of the local database to the remote database:
$ git push -u origin master
Okay. Wait for git to Push your code ~ Is it easy?