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

gh-pages -d dist overwrites custom domain #127

Closed
hyperh opened this issue Oct 2, 2016 · 7 comments · Fixed by #533
Closed

gh-pages -d dist overwrites custom domain #127

hyperh opened this issue Oct 2, 2016 · 7 comments · Fixed by #533

Comments

@hyperh
Copy link

hyperh commented Oct 2, 2016

When I use my npm script like so

    "deploy": "npm run build:prod &&  gh-pages -d dist"

My custom domain is overwritten by gh-pages to be my default Github Pages project domain. I have to go into my Github project settings and make the domain my custom domain every time.

@hyperh
Copy link
Author

hyperh commented Oct 5, 2016

Seems like adding CNAME to the root of my dist directory fixes things. My CNAME file has the following content:

mycustomurl.com

@giocodes
Copy link

giocodes commented Aug 2, 2017

I noticed that create-react-app was removing the CNAME from the /build folder and solved it like this: "deploy": "yarn run build && echo 'sigr.online' > ./build/CNAME && gh-pages -d build"

Also noticed that if you add the CNAME file inside the /public folder, create-react-app will include it in the build output.

@mbrochh
Copy link

mbrochh commented Jan 28, 2018

Had the same issue with GatsbyJS. Putting the CNAME file into the static folder solved it.

sinkcup added a commit to openwrtio/openwrtio.github.io that referenced this issue Feb 21, 2018
keywordnew added a commit to keywordnew/keywordnew.github.io that referenced this issue May 18, 2018
sh78 added a commit to sh78/sh78.github.io that referenced this issue Jun 18, 2018
pkkummermo pushed a commit to ExploratoryEngineering/docs.nbiot.engineering that referenced this issue Sep 25, 2018
vjousse added a commit to allo-media/tech-blog that referenced this issue Jan 18, 2019
@jlozovei
Copy link

jlozovei commented Mar 7, 2019

I was facing the same issue and solved it with the following scripts within package.json:

"scripts": {
  "predeploy": "yarn build && cp CNAME ./dist",
  "deploy": "gh-pages -d dist"
}

@awentzel
Copy link

I'm having the same issue with a Lerna repository + Docusaurus publishing via wrapper on https://github.com/microsoft/fast-dna which has my CNAME file inside the root of the project. Though, I'm starting to think it actually needs to be in the root of what gh-pages sees as the branch, so I will try this next.

@giteshjha
Copy link

For angular 8.
Create a CNAME file inside the src folder.
then Inside angular.json
"assets": [
"src/favicon.ico",
"src/assets",
"src/CNAME" // This is the change you need to make.
],

@amrsekilly
Copy link

amrsekilly commented Feb 9, 2020

I had the same issue with Gatsby, so I added the CNAME file to the root directory and changed the deployment script in package.json to this line: "deploy": "gatsby build --prefix-paths && cp CNAME public && gh-pages -d public -b master" and it worked.

arusak added a commit to arusak/vdhr that referenced this issue Jul 16, 2020
File CNAME must be present in root dir
tschaub/gh-pages#127
szabozoltan69 added a commit to IFRCGo/go-user-library that referenced this issue Oct 6, 2021
szabozoltan69 added a commit to IFRCGo/go-user-library that referenced this issue Oct 6, 2021
leozqi added a commit to leozqi/leozqi.github.io that referenced this issue Jul 15, 2022
Create CNAME for custom domains as per [this thread](tschaub/gh-pages#127 (comment)).
leozqi added a commit to leozqi/leozqi.github.io that referenced this issue Jul 15, 2022
Create CNAME for custom domains as per [this thread](tschaub/gh-pages#127 (comment)).
nathanleiby added a commit to nathanleiby/nathanleiby.me that referenced this issue Nov 27, 2023
bojanv91 added a commit to bojanv91/codingpipe that referenced this issue Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants