The connection and use of Git and Github
Continue below, use git to upload the project to GitHub
First of all, you must have a GitHub account. It goes without saying. If you don't have one, register first. Address: https://github.com
If there is no warehouse, create a new warehouse first
Fill in the new warehouse name and remarks. Click Create to finish.
After the creation is completed, the following interface will be displayed. Put it aside first. will be used later
Because the transmission between the local Git repository and the GitHub repository is encrypted through SSH, GitHub needs to identify whether it is you who pushed. As long as GitHub knows your public key, it can confirm that only you can push, so you need to configure the ssh key.
1. Create an SSH Key.
In the user's home directory (C:\Users\Administrator), check whether there is a .ssh file. If so, check whether there are these two files under the id_rsa
file id_rsa.pub
. If there is already, you can go directly to the next step. If not, open Git Bash, enter the command, create an SSH Key
1 |
|
Just go back
When the above picture appears, it means that the creation is successful, and then go to the user's home directory to find the .ssh
folder, there are id_rsa
two id_rsa.pub
files in it, and these two are the key pair of the SSH Key, which is the private key id_rsa
and cannot be leaked. id_rsa.pub
public.
2. Next, go to GitHub, open the "Account settings"--"SSH Keys" page, then click "Add SSH Key", fill in the Title (freely write), and paste id_rsa.pub
the entire contents of the file in the Key text box.
Click "Add Key", you should see the keys that have been added, you can add multiple keys
3. To verify whether it is successful, enter the following command in git bash
1 |
|
If you set it for the first time, the following interface will appear, enter yes to agree
4. Start setting username and email below, because github will record them every time they commit
1 2 |
|
5. The next step is to upload the local warehouse to github. A new warehouse was built on GitHub before, and the page to jump to, just operate according to the above.
1 2 |
|