One, download Git
The download speed of git official website will be slower, I suggest you go here to download
https://npm.taobao.org/mirrors/git-for-windows/
Official website address: https://git-scm.com/downloads
Just install next, you can also change it according to your needs
Two, bind users
Find Git Bash in the start menu
After opening it is like this
Enter the following sentence to set the user name and email address
(the user name and email address here must be consistent with the github registration)
git config --global user.name XXX(用户名)
git config --global user.email XXX(密码)
Three, set SSH key
Enter the following sentence and press Enter all the way
ssh-keygen -t ras -C XXX(你的邮箱)
This means success
Then go to the path in the above figure to find the .ssh file, open the id_rsa.pub file (open with Notepad)
There will be a long list of messy content in the notepad, we need to add it to our Github
Enter Github (Google Chrome can be translated into Chinese by right-clicking on the webpage), log in to your account, click on your avatar in the upper right corner, and select Settings
Click SSH and GPG keys
Click New SSH key
Copy the string of characters from the notepad to the box under Key, and write your own name in Title
Click Add SSH key below after completion
Let's go back to Git Bash to verify success, enter the following statement
ssh -T [email protected]
Enter yes
This indicates success (I have a warning here, but it does not affect the upload of the later project)
Three, upload the local project to GitHub
Create a new repository on GitHub, click on the avatar in the upper right corner, and select New repository
Enter a custom name, description, and whether it is public or not, and click Create repository when finished
Select SSH, copy the address, which will be used later
(here I just chose HTTPS at the beginning, and later the execution prompt does not recognize https, using SSH is no problem, the picture is the HTTPS address, and the SSH address starts with git@)
Find the project you want to upload on your computer, right click and select git bash here to get a new Git Bash window, where the path becomes the path of our project
Enter the following sentences in sequence
git init //初始化
git add . //上传文件夹下所有内容(注意add和.之间也有空格)
git commit -m XXX(要上传项目的名字)
git remote add origin XXX(内容可以随意写)
git push -u origin master
The execution is successful like this
We can see that our project has been uploaded successfully on our GitHub