question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deploy script removes github pages custom domain

See original GitHub issue

When using these to deploy to github :

git commit -am "Save local changes"
git checkout -B gh-pages
git add -f build
git commit -am "Rebuild website"
git filter-branch -f --prune-empty --subdirectory-filter build
git push -f origin gh-pages
git checkout -

Github loses the custom domain setting

Note : I think it’s due to the -B option in git checkout -B gh-pages.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

28reactions
fsoncommented, Oct 4, 2016

Also gh-pages will overwrite the CNAME file, because it just always pushes everything from the build folder to the gh-pages branch.

A simple workaround for this problem is to add a CNAME file with the custom domain inside the public folder in your project and it will be copied to the build and deployed.

2reactions
Janpotcommented, Oct 25, 2016

@dsernst yeah, not sure why I didn’t put my original script. And in retrospect I regret my decision.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deploying seems to overwrite custom domain #213 - GitHub
I am deploying a GatsbyJS site to GitHub pages with this command: gatsby build --prefix-paths && gh-pages -d public -b master.
Read more >
gh-pages -d dist overwrites custom domain · Issue #127 - GitHub
When I use my npm script like so "deploy": "npm run build:prod ... I noticed that create-react-app was removing the CNAME from the...
Read more >
Pushing changes to GitHub Pages branch removes custom ...
As advertised: pushing changes to GitHub Pages branch removes custom domain setting. This could be a problem with another repo sharing the ...
Read more >
[v2] Deploying to GitHub pages removes custom domain from ...
If you deploy to GitHub pages with a custom domain, the custom domain will be removed from the repository settings and you need...
Read more >
Deploying is overwriting custom domain on GitHub Pages #529
Push to the repo and trigger CI -> the custom domain is removed from the Pages config. Expected behaviour. Does not remove the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found