Upload the local project to GitHub (includes Git installation and configuration method)

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

Choose software
After opening it is like this

git bash
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

ssh
Then go to the path in the above figure to find the .ssh file, open the id_rsa.pub file (open with Notepad)

pub
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

setting
Click SSH and GPG keys

setting
Click New SSH key

new

Copy the string of characters from the notepad to the box under Key, and write your own name in Title

ssh
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]

ssh
Enter yes

ssh
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

repository
Enter a custom name, description, and whether it is public or not, and click Create repository when finished

Insert picture description here

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@)

repository
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

bash
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

success

We can see that our project has been uploaded successfully on our GitHub

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_44042316/article/details/104468416