about uscontact

How to deploy subfolder to Github Pages

Category:
Author: zemna
Date: April 17, 2021
Share this:

We can use git subtree to do this. And also nest git commands to execute force push (Reference).

git push origin `git subtree split --prefix subfolder-name-here master`:gh-pages --force

Put this command to package.json file like bellow.

{
"name": "My App",
"dependencies": { ... },
"scripts": {
"deploy": "git push origin `git subtree split --prefix subfolder-name-here master`:gh-pages --force"
}
}

After that, we can use npm run deploy command to deploy subfolder to gh-pages branch.

Share this:

Leave a Reply

Your email address will not be published. Required fields are marked *

ZEMNA.NET

Professional software development agency estalished in Indonesia. We offers website setup, web application development, fulfillment service, and etc.
Follow us
Follow us to get latest news and tutorials.
2022 - Copyright, All Rights Reserved, Made by ZEMNA.NET with ❤️
magnifiercrossmenu