Unable to change source branch in GitHub Pages

gh-pages branch
gh-pages branch not showing
gh-pages build
github pages view branch
github pages source disabled
github pages _config
your github pages site is currently being built from the master branch
create gh-pages branch

I have created a simple web site for GitHub Pages. The source of the site is in the "master" branch and the generated web site (what I want to see published) is under the "gh-pages" branch.

I was expecting to be able to change the source of the site in the settings. However, the setting is grayed out? I cannot change it (see screenshot below). What am I doing wrong? How do I switch to the "gh-pages" branch?

Personal or organization sites are built from master. gh-pages branch is used to build sites for projects.

As far as I can see, you're using https://user-name.github.io/ url, this is a personal one, so that's why master branch is the default one.

See the documentation page

If your site is a User or Organization Page that has a repository named <username>.github.io or <orgname>.github.io, you cannot publish your site's source files from different locations. User and Organization Pages that have this type of repository name are only published from the master branch.

So the answer is No, you can not change it. You'll have to adjust your workflow and keep development in another branch (let's call it development) and merge to master when you're ready to publish.

Can't change source in Github Pages Settings to /docs (Step 5 , You can configure GitHub Pages to publish your site's source files from master [hostname] , you cannot publish your site's source files from different locations. branch, you can create them and then return to source settings to change your� You can configure GitHub Pages to publish your site's source files from master, gh-pages, or a /docs folder on your master branch for Project Pages and other Pages sites that meet certain criteria. If your site is a User or Organization Page that has a repository named <username>.[hostname] or <orgname>.[hostname] , you cannot publish your site

FWIW, this is the setup I used for publishing a personal page (i.e. https://user-name.github.io) using Next.js and gh-pages:

  1. Create a different default branch in your repo to work in (e.g. develop)
  2. Build a static export of your site: next build && next export
  3. Put a .nojekyll marker file in the export directory: touch out/.nojekyll
  4. Upload the static export to the master branch: gh-pages -t -b master -d out

You can bundle these commands in package.json to get a convenient yarn deploy command:

scripts: {
  ...
  "build": "next build",
  "export": "yarn run build && next export",
  "deploy": "yarn export && touch out/.nojekyll && gh-pages -t -b master -d out"
  ...

Configuring a publishing source for GitHub Pages, If you use the default publishing source for your GitHub Pages site, your site will publish automatically. You can also choose to publish your site from a different branch or folder. folder for publishing source. Click Save. Button to save changes to publishing source settings Ask a human. Can't find what you're looking for? GitHub is a "social coding" site. It allows you to upload code repositories for storage in the Git version control system. You can then collaborate on code projects, and the system is open-source by default, meaning that anyone in the world can find your GitHub code, use it, learn from it, and improve on it. You can do that with other people's code too! This article provides a basic guide to

Ok so if you are using angular-cli-ghpages it will by default create a new branch gh-pages and publish to it.

Now as a starter, like me, if you are using https://user-name.github.io/ and you want your app to be published from the master branch of your user-name.github.io you can follow the below steps.

  1. Make a production ready build using

    ng build --prod --base-href "/user-name.github.io/"
    
  2. Deploy to the master using angular-cli-ghpages using

    angular-cli-ghpages --branch=master
    

Hope this helps.

Configuring a publishing source for your GitHub Pages site, node-server.js // a very simple node server for local development source/ // psd fatal: Cannot update paths and switch to branch 'gh-pages' at the same time. To learn more about how to build your site's source files from a /docs folder on the master branch, see "Configuring a publishing source for GitHub Pages." Step 2: Install Jekyll using Bundler To track your site's dependencies, Ruby will use the contents of your Gemfile to build your Jekyll site.

Setup GitHub Pages "gh-pages" branch and "master" branch as , However, the setting is grayed out? I cannot change it (see screenshot below). What am I doing wrong? How do I switch to the "gh-pages" branch? In order to push your branch to another remote branch, use the “git push” command and specify the remote name, the name of your local branch as the name of the remote branch. $ git push <remote> <local_branch>:<remote_name> As an example, let’s say that you have created a local branch named “my-feature”. $ git branch master * my

Unable to change source branch in GitHub Pages - github - html, gh-pages branch. So it doesn't look like you're able to define a custom folder or branch yet. 3 Likes. Head over to GitHub and create a new repository named username.github.io, where username is your username (or organization name) on GitHub. If the first part of the repository doesn’t exactly match your username, it won’t work, so make sure to get it right.

Can I define a custom source or folder from which my site hosted on , dblock.github.io and dotnetinstaller (if it's not a folder of a User or Organisation page) is located at github.com/dblock/dotnetinstaller in the gh-pages branch. If another_branch already exists locally and you are not on this branch, then git checkout another_branch switches to the branch.. If another_branch does not exist but origin/another_branch does, then git checkout another_branch is equivalent to git checkout -b another_branch origin/another_branch; git branch -u origin/another_branch.

Comments
  • Did you find any fix for this issue?
  • Current way is too limited. For instance, I've just changed my main branch from master to v1, but doc can only be generated from master branch, even if the branch doesn't exist. I wish it would allow to build a site doc, per branch. That'd be awesome for documenting versions and be able to preview new releases that aren't in master branch yet.
  • Thank you @Anton for the details. I was hoping to be able to have the site source under master and the generated site under gh-pages. It looks like I misunderstood how this works.
  • has anybody found a way around this?
  • what if i want to deploy from root /docs folder? where static files are built for a vue.js project
  • Here from 2020, my problem was that I had made a repo this name "<username>.github.io", and github settings was forcing me to only stay on the master. I went and changed the name of my repository to something that did not have "github.io" at the end, and then I was able to switch over. Only thing now is that the content moved over to https://<username>.github.io/<newname-for-repo>/ .