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

Custom domain gets deleted on deploy - CNAME not working #236

Closed
whoisryosuke opened this issue Apr 6, 2018 · 21 comments
Closed

Custom domain gets deleted on deploy - CNAME not working #236

whoisryosuke opened this issue Apr 6, 2018 · 21 comments

Comments

@whoisryosuke
Copy link

I have an issue where each time I use gh-pages to deploy, my custom domain gets deleted. I tried adding a CNAME file to my project with the domain name, but it doesn't change anything. Each deploy I have to manually set the domain again.

I run gh-pages -d public when deploying.

You can see the project repo here:
https://github.com/whoisryosuke/ryosuke-gatsby-blog

Not sure if this is an issue with my stack (GatsbyJS) or the gh-pages lib.

@whoisryosuke whoisryosuke changed the title CNAME not working Custom domain gets deleted on deploy - CNAME not working Apr 6, 2018
@Ehesp
Copy link

Ehesp commented Apr 10, 2018

Also getting this issue

@adamsandle
Copy link

In your instance add the CNAME file to the static folder.

@whoisryosuke
Copy link
Author

@adamsandle the CNAME file is in the gh-pages branch when I deploy (https://github.com/whoisryosuke/ryosuke-gatsby-blog/blob/gh-pages/CNAME), but I'll add it to the static folder and see if it makes a difference 👍

KevinAst added a commit to KevinAst/MyWeb that referenced this issue Sep 17, 2018
@ivoilic
Copy link

ivoilic commented Oct 9, 2018

I'm also having this issue. You have to manually re-enter the costume domain in the repos settings and in my case turn off force https.

@whoisryosuke
Copy link
Author

@ivoilic I was able to resolve this by committing the CNAME file to the branch gg-pages deploys from.

@juniorpires
Copy link

Thanks. It helps a lot.

@kietnam
Copy link

kietnam commented Dec 2, 2018

I have the same issue..

@LeslieOA
Copy link

LeslieOA commented Mar 3, 2019

@ivoilic I was able to resolve this by committing the CNAME file to the branch gg-pages deploys from.

Where and/or how should I be committing the CNAME to the repo?
I'm using Gatsby with a public repository.
Is this in the docs or am I missing something? Thanks.

@whoisryosuke
Copy link
Author

@LeslieOA should be something like (assuming you push to origin):

git checkout gh-pages git add CNAME git commit -m ‘:wrench: Added CNAME’ git push gh-pages origin

@LeslieOA
Copy link

LeslieOA commented Mar 3, 2019

@LeslieOA should be something like (assuming you push to origin):

git checkout gh-pages git add CNAME git commit -m ‘:wrench: Added CNAME’ git push gh-pages origin

Hey Ryosuke.
Ah! So I need a (plaintext/text/plain?) file named CNAME in the root of my repository?
Any link(s) to the docs for it's format/content(s)?

Thanks.

P.S. Nice (Gatsby) site BTW!

@whoisryosuke
Copy link
Author

@LeslieOA yep. plaintext with your domain in it. you can see an example in my repo.
and thanks 😊

@jwld
Copy link

jwld commented Jan 10, 2020

Still having this issue - do you have to commit the CNAME on the gh-pages branch every time you deploy?

@jwld
Copy link

jwld commented Jan 10, 2020

Ah right, for anyone else having this issue just keep a CNAME file in the dist folder or whatever you're deploying from (I guess this is the static folder referred to above). So if your deploy script is "deploy": "gh-pages -d dist" then keep a copy in dist.

@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.
],

@sanny-io
Copy link

For those who use create-react-app, put the CNAME file in the public folder and it will be part of the build output.

niko7o added a commit to niko7o/nikoto.dev that referenced this issue Apr 12, 2020
mathildebuenerd pushed a commit to mathildebuenerd/portfolio-gatsby that referenced this issue May 22, 2020
@colinmorris
Copy link

In your instance add the CNAME file to the static folder.

Just to add some context to this excellent solution from adamsandle, here's the documentation on the static folder. If it doesn't already exist, you'll need to create a directory called static at the root of your project.

arknoll pushed a commit to RockRobotic/rock-doc that referenced this issue Jul 27, 2020
@Abhay07
Copy link

Abhay07 commented Sep 18, 2020

I guess you have alreayd figured out the issue that, CNAM file is removed, if you deploy new changed. You need to take backup of the CNAME file and then put it after the build is made. I wrote a shell script for doing this in making this tool MyIps

digikata added a commit to digikata/digikata.github.io that referenced this issue Dec 23, 2020
Otherwise github unsets the custom domain service on a push
the CNAME file in the root publish directory works around that

See tschaub/gh-pages#236
digikata added a commit to digikata/digikata.github.io that referenced this issue Dec 23, 2020
Otherwise github unsets the custom domain service on a push
the CNAME file in the root publish directory works around that

See tschaub/gh-pages#236
think-mm added a commit to think-mm/bnsite that referenced this issue Jan 24, 2021
- add this with deployment output as per tschaub/gh-pages#236
@Nirzak
Copy link

Nirzak commented Apr 1, 2021

In your instance add the CNAME file to the static folder.

Just to add some context to this excellent solution from adamsandle, here's the documentation on the static folder. If it doesn't already exist, you'll need to create a directory called static at the root of your project.

Thanks the static folder method is working like a charm. Everyone who is using automatic deploying script just put your CNAME file in a static folder. The script will include the CNAME file on the next deployment.

hyochan added a commit to dooboolab-community/react-native-iap that referenced this issue Jun 15, 2021
rjc123 added a commit to rjc123/robincarswell.com that referenced this issue Jun 22, 2021
think-mm added a commit to think-mm/bnsite that referenced this issue Jul 16, 2021
- add this with deployment output as per tschaub/gh-pages#236
- arc = archive
noxware added a commit to noxware/noxware.github.io that referenced this issue Jul 22, 2021
davegallant added a commit to davegallant/site that referenced this issue Sep 20, 2021
atiq-cs added a commit to atiq-cs/note that referenced this issue Nov 2, 2021
- add this with deployment output as per tschaub/gh-pages#236
think-mm added a commit to think-mm/bnsite that referenced this issue Nov 17, 2021
- add this with deployment output as per tschaub/gh-pages#236
think-mm added a commit to think-mm/bnsite that referenced this issue Nov 17, 2021
- add this with deployment output as per tschaub/gh-pages#236
think-mm added a commit to think-mm/bnsite that referenced this issue Nov 17, 2021
- add this with deployment output as per tschaub/gh-pages#236
atiq-cs added a commit to atiq-cs/note that referenced this issue Dec 1, 2021
- add this with deployment output as per tschaub/gh-pages#236
atiq-cs added a commit to atiq-cs/note that referenced this issue Dec 1, 2021
- deployment yml file
- set checkout submoodule to true so that theme is included

CNAME ref: add this with deployment output as per tschaub/gh-pages#236
atiq-cs added a commit to atiq-cs/note that referenced this issue Dec 1, 2021
- deployment yml file
- set checkout submoodule to true so that theme is included

CNAME ref: add this with deployment output as per tschaub/gh-pages#236
atiq-cs added a commit to atiq-cs/note that referenced this issue Dec 1, 2021
- deployment yml file
- set checkout submoodule to true to include theme
- actions/checkout:
  - use traditional tagged version
- utilize release configuration

CNAME ref: add this with deployment output as per tschaub/gh-pages#236
atiq-cs added a commit to atiq-cs/note that referenced this issue Dec 1, 2021
- deployment yml file
- set checkout submoodule to true to include theme
- actions/checkout:
  - use traditional tagged version
- utilize release configuration

CNAME ref: add this with deployment output as per tschaub/gh-pages#236
atiq-cs added a commit to atiq-cs/note that referenced this issue Dec 2, 2021
- deployment yml file
- set checkout submoodule to true to include theme
- actions/checkout:
  - use traditional tagged version
- utilize release configuration

CNAME ref: add this with deployment output as per tschaub/gh-pages#236
dontrolle added a commit to mangrovedao/mangrove.js that referenced this issue Jan 17, 2022
jkrivine pushed a commit to mangrovedao/mangrove.js that referenced this issue Jan 17, 2022
jschoedl pushed a commit to jschoedl/4colors that referenced this issue Mar 28, 2022
@fedorovpishet
Copy link

@adamsandle thank you so much! You save me!!!

marc-portier added a commit to arms-mbon/arms-mbon.github.io that referenced this issue Apr 17, 2023
adding per advice in this thread --> tschaub/gh-pages#236
marzuq-adebayo-dev added a commit to marzuq-adebayo-dev/React-Native-iap that referenced this issue May 20, 2023
@cameronkruse
Copy link

In your instance add the CNAME file to the static folder.

This is a pretty old thread, but where I found the answer to this question. One hang up I had was the CNAME file I downloaded as an example was converted to a .txt file when it was downloaded. The file that is added to the static folder should not have a filetype ending it should just be CNAME with the custom URL as it's contents.

ocapuozzo added a commit to ocapuozzo/musaicbox-app that referenced this issue Mar 31, 2024
charlieforward9 added a commit to charlieforward9/NEW_HEAT that referenced this issue Jul 5, 2024
@kaischreurs
Copy link

One hang up I had was the CNAME file I downloaded as an example was converted to a .txt file when it was downloaded. The file that is added to the static folder should not have a filetype ending it should just be CNAME with the custom URL as it's contents.

Thank you so much, I've been trying to fix this for 15 minutes and this was the issue.

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

No branches or pull requests