The vue packaged project is uploaded to github, opened in the form of a page, and then generates a link (you can fill in your own project link on the page during the interview). Super detailed tutorial.

First create your own account on github, if you already have an account, create a warehouse directly. (This step is usually done)

Respository name is the name you gave to the repository, and it is also the link to the project after the last upload is successful.

 Then click Create directly below.

After the creation is complete, create a new warehouse branch. The name of the branch must be gh-pages, which will be used later.

 This will have a fork of gh-pages.

In this way, you can proceed to the next step, go to the warehouse and push it to github, and copy the link in the code.

 Find the file you want to upload to the page below.

But you need to install git on the computer first. If you haven’t installed it, you can search for how to install it yourself. This is very simple. After the installation is complete or if you already have git, execute the following code once.

The premise of uploading is that no matter whether it is a static page or a vue project package in the folder, there must be only one index.html page file in it. This is very critical, because the server will automatically recognize the index.html file when it starts the page .

Then right-click in the folder to upload and select Git Bash Here

 Enter in turn:

Initialize warehouse

git init

add all

git add .

gie commit -m "Write the introduction to the warehouse here"

Create a branch, the name of the branch must be gh-pages

git branch gh-pages

 

then switch branches

git checkout 

Then link to github, temporarily save the file just submitted to the github server, and copy the link just copied on the page code to the following code.

git remote add origin copied link

 

Next, enter: git pull origin master: To avoid file conflicts, pull down the files on github first. If an error occurs, enter git pull origin master --allow-unrelated-histories

Because it is not a Chinese server, it will fail when the network speed is not good, so try a few more times.

Note: I don’t know whether it’s the computer problem or the internet speed. It can only be effective by typing git pull origin master --allow-unrelated-histories. You can try: git pull origin master first, if it doesn’t work, then do the same as me.

last input

git push origin gh-pages

Commit the file to the github branch.

This is a success, and then go to the github warehouse, on the gh-pages branch, and refresh the page to see it.

 Then click settings

There is a Pages inside. After clicking, you will see a link. This link is the page where you upload the project. You can directly access it by clicking it or sending it to others.

This link I just uploaded: Document icon-default.png?t=M85Bhttps://daimengje.github.io/dabao_ceshi/  This is the first time I send something on my blog that I think is not very complicated but some people can't figure it out, here is the step by step As long as you don't make a mistake in the middle, you can succeed in one go. Well, you can try it if you need it.

 

 

 

Guess you like

Origin blog.csdn.net/qq_45802269/article/details/127310952