Introduction: Recently I have been learning how to use VUe-CLI to quickly build projects and how to put my written projects on Github, and provide quick entry demo for visitors. This is my blog search to a short book about vue program on how to upload the making and provide demo the entrance to the article: www.jianshu.com/p/13df61095… However, the article was written in 2017, and I noticed that something was already different from what was written in the article, so I revised my notes.

When we visit other people’s projects on Github, we often see some demo entry, click on it, and see the project quickly. Instead of having to clone the project to the local, install some dependencies, and finally start a local service to see the effect.

Note: After the scaffolding of VUE-cli3 is completed, the vue.config.js file is not found in the project directory. You need to create it manually and create vue.config.js in the root directory

Enter the following code in the file

module.exports = { publicPath: process.env.NODE_ENV === 'production' ? '/', '/'}Copy the code

Step 1: Git installation: Baidu is enough

Step 2: Create a local repository

Git Bash Here: Git Bash Here

Step 3: Run git init

Git init: Turn this folder into a Git-manageable repository with the command git init. You’ll notice that myCangku has a.git folder, which git uses to track and manage repositories. If you can’t see it because it’s hidden by default, then you need to make it visible.

Step 4: Copy and paste our written VUE project into this directory

Git status

Git status: Check the current repository status. Red files indicate files to be added

Step 6: Git add

Add all the projects you just copied to the repository with git add. The dot after git add indicates that everything in that folder is added to the local repository. Git status allows you to check the status of your local repository again

Git commit -m “first commit”

git commit -m “first commit”

Commit the file you just added to the local repository. -m indicates the comment content submitted this time. You can omit this comment, but you’d better write it, otherwise an error will be reported. Now that you’re done with your local Git repository, it’s time to connect to your remote repository (Github)

Step 8: Associate the local repository with the Github repository

Most Git servers will choose to use an SSH public key for authorization. Each user in the system must provide a public key for authorization, or generate one if not available. The process for generating a public key is similar on all operating systems. First you need to make sure that the machine already has a public key.Copy the code
We can run CD ~ (back to the home directory) and then cd.ssh from the command lineCopy the code

Pub. The file with the. Pub suffix is the public key, and the other file is the key.Copy the code

If not, create a new SSH key by typing:

Ssh-keygen -t rsa -c “Your email address”.

Enter the password by default

$Enter the password: 123456

$Confirm password: 123456

This generates SSH keys in the C:\ user.ssh folder. Contains two files rd_rsa and id_rsa.pub

Run commands to view the generated secret key

cat ~/.ssh/id_rsa.pub

Copy the public key

Step 9: Log on to Github

Step 10: Create the Github repository

Here I created a repository named my_github_cangku and chose to add the readme.md file for the repository.

Step 11: Associate the local repository with the Github repository

‘Progress just created local repository myCangku

Execute the following command git remote add origin https://github.com/weirui88888/my_github_cangku website is the website of warehouse ` hereCopy the code

At this point, myCangku is associated with github my_github_cangkuCopy the code

Step 12: Push all the content in the local repository to the Github repository

Git push -u origin master -u origin master -u origin master Git push origin master git push origin master If Initialize this repository with a README is checked, So to step 9 you will local repository content when pushed to the remote warehouse will be submitted to a failed to push some refs to https://github.com/guyibang/TEST2.git's fault.Copy the code

Git pull --rebase origin master git pull --rebase origin master git pull --rebase origin masterCopy the code

Note: github2020 after the revision, at this time operation upload file in another branch. Such as:

CNPM run build generates a dist directory with an index. HTML file and a static directory (for CSS, js, img).Copy the code

Git add -f "dist" -f "git commit" -m "git push origin master At this point, the github repository my_github_cangku has the following directory structureCopy the code

Click setting on the repository to find the Github Pages module and change source from None to Master Branch. At this time, a url will be generated, which is the access url of the Github repository. We can join the index.html path in dist just nowCopy the code

Such as: https://weirui88888.github.io/my_github_cangku/ netease strictly selected/dist/index. The HTML we put the url in the README. Md, we demo to scan can be realized.Copy the code