Deploy the project to GitHub (detailed)

premise

Already registered a GitHub account

Create repository

Enter the + in the upper right corner of the GitHub official website , select new repository , then configure as shown in the figure, and finally complete the creation

insert image description here

insert image description here

Git tools

Download address : https://git-for-windows.github.io/

Configure Git

After the installation is complete, open Git bash
and enter:
fill in your GitHub email in the middle

ssh-keygen -t rsa -C “[email protected]

Enter all the way, do not set the password, enter the directory under C drive after the creation: The
insert image description here
id_rsa.pub file contains the key we need, copy it down
Open Github and
insert image description here
insert image description here
create a new SSH keyinsert image description here
insert image description here

Building a local warehouse

Then you need to create a repository on the local disk:
insert image description here
then right-click and open Git Bash here

git clone https://github.com/xxxxxxxx

The following is the URL of the GitHub repository created before. After the
operation is completed, the folder will clone the existing folder
insert image description here

Deploy to Git repository

Then enter the cloned folder, right-click and open Git bash here

git init

After git init, a .git folder will be created and
insert image description here
then execute:

git add “项目名” 
git commit -m “xxx”  //这里是项目注释

insert image description here
(here in my git add ., some files have warnings, ignore them for the time being)
insert image description here

Possible problems 1

During the execution, you will be prompted to bind the email address or name of GitHub. Follow the prompt to bind and
then add the warehouse address on GitHub.

git remote add origin 你GitHub仓库网址

insert image description here
(My accelerator will have many sources, just choose the first one)

Possible problems 2

insert image description here

error: remote origin already exists

The remote origin already exists
. Execute the delete statement:

git remote rm origin

insert image description here
continue

git remote add origin 你GitHub仓库网址

insert image description here
Finally, associate this repository with the github repository and push the local repository:

git pull origin main

insert image description here

git push origin main

insert image description here

Check out the GitHub repository

insert image description here
Project deployment is successful! ! !

Guess you like

Origin blog.csdn.net/weixin_50679163/article/details/124311831