With the popularity and use of WeChat mini programs, more and more developers have begun to upload their own mini programs to code hosting platforms for management and sharing, among which gitee is the first choice for many developers. But for novices, they may encounter some problems, so this article will introduce in detail how to upload gitee to WeChat applet.
1. Register a gitee account and create a warehouse
First, we need to register an account on gitee and create a new warehouse so that we can upload small programs to the warehouse.
1. Enter gitee.com in the browser to enter the official website, click the "Register" button in the upper right corner, and fill in the necessary information to register successfully.
2. After successful registration, we can log in to our gitee account. After entering the gitee homepage, click the "plus" button in the upper right corner and select "New Repository" to create a new code repository.
3. In the create warehouse page, fill in the name and description information of the warehouse, and select public or private, then select "Initialize git warehouse" and select "Node.js" as the language of the code warehouse, and finally click Click the "Create Warehouse" button to create it successfully.
2. Upload the WeChat applet to gitee
Next we need to upload the WeChat applet to the gitee code repository. Here we take the Windows system as an example. The steps are as follows:
1. Open the WeChat applet development tool, enter the applet project we want to upload, and select "Tools" -> "Build npm" in the menu bar.
2. After the construction is completed, find the "miniprogram_npm" folder in the mini program project directory in the file explorer, copy it to the project directory, and delete the original "node_modules" folder.
3. Enter the project root directory, right-click and select "Git Bash Here" to open the Git Bash terminal.
4. Enter the following command in the Git Bash terminal to initialize git:
$ git init
5. Associate the gitee warehouse we just created with the local git warehouse, the command is as follows:
$ git remote add gitee <gitee仓库地址>
Note: You need to replace the address in <> with the address of the gitee warehouse we created.
6. Add all files in the current directory to the local git repository, the command is as follows:
$ git add .
7. Submit our local code to the git repository, the command is as follows:
$ git commit -m "Initial commit"
Note: "Initial commit" is the comment for this submission, which can be modified according to the actual situation.
8. Push the local code to the gitee warehouse, the command is as follows:
$ git push gitee master
Note: "gitee" in the command is the remote warehouse alias we added before, and "master" is our current The name of the branch where it is located shall be modified according to the actual situation.
9. After the upload is successful, refresh the gitee warehouse page and you can see the small program code we uploaded.
3. Update the WeChat applet to gitee
After we make modifications locally, we need to upload the updated code to the gitee warehouse. At this time, we only need to perform the following steps :
1. In the project root directory, right-click and select "Git Bash Here" to open the Git Bash terminal.
2. First update the local git library, the command is as follows:
$ git pull
3. Upload the local code to the gitee warehouse, the command is as follows:
$ git push gitee master
So far, we The WeChat applet was successfully uploaded to the gitee code hosting platform. Hosting our mini program code through gitee not only facilitates version management, but also allows us to share and communicate with other developers, promote code exchange and improvement, and make mini program development more convenient and efficient.
The above is the detailed content of How to upload gitee to WeChat applet. For more information, please follow other related articles on the PHP Chinese website!