host github pages from /dist folder in master branch





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







7















I was trying to publish my -username-.github.io repository to github pages but my index.html is inside dist folder.



I cannot use git subtree push --prefix dist origin gh-pages because this is meant for project pages, not user/org pages.



All I want is, github to treat dist as root directory for hosting user/org page. Please help.Thanks



PS: I don't want to do redirection hack.










share|improve this question































    7















    I was trying to publish my -username-.github.io repository to github pages but my index.html is inside dist folder.



    I cannot use git subtree push --prefix dist origin gh-pages because this is meant for project pages, not user/org pages.



    All I want is, github to treat dist as root directory for hosting user/org page. Please help.Thanks



    PS: I don't want to do redirection hack.










    share|improve this question



























      7












      7








      7


      1






      I was trying to publish my -username-.github.io repository to github pages but my index.html is inside dist folder.



      I cannot use git subtree push --prefix dist origin gh-pages because this is meant for project pages, not user/org pages.



      All I want is, github to treat dist as root directory for hosting user/org page. Please help.Thanks



      PS: I don't want to do redirection hack.










      share|improve this question
















      I was trying to publish my -username-.github.io repository to github pages but my index.html is inside dist folder.



      I cannot use git subtree push --prefix dist origin gh-pages because this is meant for project pages, not user/org pages.



      All I want is, github to treat dist as root directory for hosting user/org page. Please help.Thanks



      PS: I don't want to do redirection hack.







      github deployment build gulp github-pages






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 26 '17 at 15:13







      pranavjindal999

















      asked Feb 26 '17 at 14:38









      pranavjindal999pranavjindal999

      1,1751921




      1,1751921
























          2 Answers
          2






          active

          oldest

          votes


















          4














          You can't do it this way.



          GitHub pages can be hosted from either:




          • the / folder in the master branch

          • the / folder in the gh-pages branch

          • the /docs folder in the master branch


          But the user pages must be built from the / folder in the master branch.



          TIP



          Code on another branch than the master. After every push to this branch, build it in any CI/CD tool and push it back to the master branch.






          share|improve this answer

































            3















            Configuring a publishing source for GitHub Pages (very limited)



            While you can select a folder as the source for gh-pages, you can only do so for the /docs directory at the parent level, and you still have to actually commit the built files in order to do so, which means you'll have to override the .gitignore and commit them twice





            Automated Deploy Scripts



            If you're using npm, there are a couple packages that handle publishing sub-directories to gh-pages. Install with option --save-dev to add it to your devDependencies:





            • push-dir



              # install
              $ npm install push-dir --save-dev

              # usage
              $ push-dir --dir=dist --branch=gh-pages



            • gh-pages



              # install
              $ npm install gh-pages --save-dev

              # usage
              $ gh-pages -d dist



            In either case, if get a command line tool working for you and get it configured with the right options, you can alias it in your package.json like this:



            "scripts": {
            "deploy": "npm run build && gh-pages -d dist"
            }


            Further Reading:




            • Deploying a subfolder to GitHub Pages

            • Deploy Vue to GitHub pages-the easy way!






            share|improve this answer


























              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f42469817%2fhost-github-pages-from-dist-folder-in-master-branch%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              4














              You can't do it this way.



              GitHub pages can be hosted from either:




              • the / folder in the master branch

              • the / folder in the gh-pages branch

              • the /docs folder in the master branch


              But the user pages must be built from the / folder in the master branch.



              TIP



              Code on another branch than the master. After every push to this branch, build it in any CI/CD tool and push it back to the master branch.






              share|improve this answer






























                4














                You can't do it this way.



                GitHub pages can be hosted from either:




                • the / folder in the master branch

                • the / folder in the gh-pages branch

                • the /docs folder in the master branch


                But the user pages must be built from the / folder in the master branch.



                TIP



                Code on another branch than the master. After every push to this branch, build it in any CI/CD tool and push it back to the master branch.






                share|improve this answer




























                  4












                  4








                  4







                  You can't do it this way.



                  GitHub pages can be hosted from either:




                  • the / folder in the master branch

                  • the / folder in the gh-pages branch

                  • the /docs folder in the master branch


                  But the user pages must be built from the / folder in the master branch.



                  TIP



                  Code on another branch than the master. After every push to this branch, build it in any CI/CD tool and push it back to the master branch.






                  share|improve this answer















                  You can't do it this way.



                  GitHub pages can be hosted from either:




                  • the / folder in the master branch

                  • the / folder in the gh-pages branch

                  • the /docs folder in the master branch


                  But the user pages must be built from the / folder in the master branch.



                  TIP



                  Code on another branch than the master. After every push to this branch, build it in any CI/CD tool and push it back to the master branch.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 8 hours ago









                  ndequeker

                  4,15064578




                  4,15064578










                  answered Feb 28 '17 at 5:43









                  Rafal SztwiorokRafal Sztwiorok

                  561




                  561

























                      3















                      Configuring a publishing source for GitHub Pages (very limited)



                      While you can select a folder as the source for gh-pages, you can only do so for the /docs directory at the parent level, and you still have to actually commit the built files in order to do so, which means you'll have to override the .gitignore and commit them twice





                      Automated Deploy Scripts



                      If you're using npm, there are a couple packages that handle publishing sub-directories to gh-pages. Install with option --save-dev to add it to your devDependencies:





                      • push-dir



                        # install
                        $ npm install push-dir --save-dev

                        # usage
                        $ push-dir --dir=dist --branch=gh-pages



                      • gh-pages



                        # install
                        $ npm install gh-pages --save-dev

                        # usage
                        $ gh-pages -d dist



                      In either case, if get a command line tool working for you and get it configured with the right options, you can alias it in your package.json like this:



                      "scripts": {
                      "deploy": "npm run build && gh-pages -d dist"
                      }


                      Further Reading:




                      • Deploying a subfolder to GitHub Pages

                      • Deploy Vue to GitHub pages-the easy way!






                      share|improve this answer






























                        3















                        Configuring a publishing source for GitHub Pages (very limited)



                        While you can select a folder as the source for gh-pages, you can only do so for the /docs directory at the parent level, and you still have to actually commit the built files in order to do so, which means you'll have to override the .gitignore and commit them twice





                        Automated Deploy Scripts



                        If you're using npm, there are a couple packages that handle publishing sub-directories to gh-pages. Install with option --save-dev to add it to your devDependencies:





                        • push-dir



                          # install
                          $ npm install push-dir --save-dev

                          # usage
                          $ push-dir --dir=dist --branch=gh-pages



                        • gh-pages



                          # install
                          $ npm install gh-pages --save-dev

                          # usage
                          $ gh-pages -d dist



                        In either case, if get a command line tool working for you and get it configured with the right options, you can alias it in your package.json like this:



                        "scripts": {
                        "deploy": "npm run build && gh-pages -d dist"
                        }


                        Further Reading:




                        • Deploying a subfolder to GitHub Pages

                        • Deploy Vue to GitHub pages-the easy way!






                        share|improve this answer




























                          3












                          3








                          3








                          Configuring a publishing source for GitHub Pages (very limited)



                          While you can select a folder as the source for gh-pages, you can only do so for the /docs directory at the parent level, and you still have to actually commit the built files in order to do so, which means you'll have to override the .gitignore and commit them twice





                          Automated Deploy Scripts



                          If you're using npm, there are a couple packages that handle publishing sub-directories to gh-pages. Install with option --save-dev to add it to your devDependencies:





                          • push-dir



                            # install
                            $ npm install push-dir --save-dev

                            # usage
                            $ push-dir --dir=dist --branch=gh-pages



                          • gh-pages



                            # install
                            $ npm install gh-pages --save-dev

                            # usage
                            $ gh-pages -d dist



                          In either case, if get a command line tool working for you and get it configured with the right options, you can alias it in your package.json like this:



                          "scripts": {
                          "deploy": "npm run build && gh-pages -d dist"
                          }


                          Further Reading:




                          • Deploying a subfolder to GitHub Pages

                          • Deploy Vue to GitHub pages-the easy way!






                          share|improve this answer
















                          Configuring a publishing source for GitHub Pages (very limited)



                          While you can select a folder as the source for gh-pages, you can only do so for the /docs directory at the parent level, and you still have to actually commit the built files in order to do so, which means you'll have to override the .gitignore and commit them twice





                          Automated Deploy Scripts



                          If you're using npm, there are a couple packages that handle publishing sub-directories to gh-pages. Install with option --save-dev to add it to your devDependencies:





                          • push-dir



                            # install
                            $ npm install push-dir --save-dev

                            # usage
                            $ push-dir --dir=dist --branch=gh-pages



                          • gh-pages



                            # install
                            $ npm install gh-pages --save-dev

                            # usage
                            $ gh-pages -d dist



                          In either case, if get a command line tool working for you and get it configured with the right options, you can alias it in your package.json like this:



                          "scripts": {
                          "deploy": "npm run build && gh-pages -d dist"
                          }


                          Further Reading:




                          • Deploying a subfolder to GitHub Pages

                          • Deploy Vue to GitHub pages-the easy way!







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Nov 27 '18 at 1:01

























                          answered Nov 25 '18 at 1:14









                          KyleMitKyleMit

                          59.2k37252415




                          59.2k37252415






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f42469817%2fhost-github-pages-from-dist-folder-in-master-branch%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              這個網誌中的熱門文章

                              Academy of Television Arts & Sciences

                              L'Équipe

                              1995 France bombings