Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CNAME file not copied in gh-pages branch after npm run deploy

I have a react app deployed with git hub pages, using gh-pages plugin. My package.json entry look like this.

"scripts": {
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build”,
     .....
   }

Eveything worked fine until I tried to use a custom domain.

  1. I configured the required A and CNAME entry in my domain provider DNS settings.

  2. I created the CNAME file in the develop branch. That is the branch that I have checked out on my local machine.

  3. I run npm run deploy on develop branch on local machine.

  4. plugin pushed the build code to gh-pages branch on remote.

  5. the gh-pages branch on remote does not contain the CNAME file.

  6. after every deploy I have to manually add the custom-domain from github settings pages section, which eventually create a CNAME file. And then every works.

Is there a configuration requied in package.json to force gh-pages plugin to copy the CNAME file ?

like image 492
ThrowableException Avatar asked Oct 27 '25 22:10

ThrowableException


1 Answers

As stated in the docs, you're just missing the --cname argument:

gh-pages -d build --cname custom-domain.com
like image 104
thiagowfx Avatar answered Oct 29 '25 19:10

thiagowfx