Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment deletes CNAME file from gh-pages branch (custom domain) #89

Closed
nimit2801 opened this issue Mar 18, 2022 · 6 comments
Closed
Assignees
Labels

Comments

@nimit2801
Copy link

Every time I use npm run deploy -- -m "Deploy React app to GitHub Pages" from my main branch to deploy on gh-pages the it resets the custom URL and I've to make a new commit for CNAME to reset it to new the custom URL. Is there a solution for the same in react-gh-pages

Screen Shots
image

Reference URL: https://github.com/Nuv-Yuva/nuvyuva

Thank You

@TheoBong
Copy link

You can just put the CNAME file in your public folder.

@gitname
Copy link
Owner

gitname commented Aug 6, 2022

Thanks, @TheoBong, for sharing a solution.

Hi @nimit2801, to elaborate on the solution shared by @TheoBong:

According to the Create React App documentation about the public folder: during the build process, files in the public folder will be copied as-is into the build folder. Running $ npm run deploy will then push the contents of that build folder to the remote gh-pages branch.

@gitname gitname self-assigned this Aug 6, 2022
@gitname gitname changed the title custom URL Deployment deletes CNAME file from gh-pages branch (custom domain) Aug 6, 2022
@nimit2801
Copy link
Author

Can we add this in the documentation for the developers to know this beforehand @gitname?

@nimit2801
Copy link
Author

Thanks, @TheoBong, for sharing a solution.

Hi @nimit2801, to elaborate on the solution shared by @TheoBong:

According to the Create React App documentation about the public folder: during the build process, files in the public folder will be copied as-is into the build folder. Running $ npm run deploy will then push the contents of that build folder to the remote gh-pages branch.

Thank you for the explanation, it really helped!

@gitname
Copy link
Owner

gitname commented Aug 6, 2022

Can we add this in the documentation for the developers to know this beforehand @gitname?

Yes, thanks for suggesting that. For now, I'll add a link to this Issue, then eventually (once I have time to test it) spell it out in the instructions.

@carlosvega20
Copy link

you can elaborate something like this:

"scripts": {
    "deploy": "cp CNAME ./public/ && gh-pages -d public"

mrfarmer777 added a commit to mrfarmer777/alto-clef-practice that referenced this issue Sep 24, 2023
bitinerant added a commit to BitBurrow/BitBurrow.github.io that referenced this issue Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants