Search code examples
gitgithubgithub-pages

is it possible to push a git repository to a folder of another repo (for example, github pages)?


I have a git repository - lets call it A, with a remote on github. I have another repo - B.

Is it possible to set up a way to push A into a subfolder in B?

For example, I have a project written in html/js/css. I want to have this project in a standalone github repo, as well as host in on my github pages repo, in a subdirectory (for example, as broshen.github.io/project/index.html)

How would I set this up?


Solution

  • You could add A as a submodule in repo B, but you'll need to commit a submodule update in B any time you want to deploy your changes.

    Since you mentioned broshen.github.io/project/index.html, it seems worth mentioning that you can add a gh-pages branch (or configure it to use docs/) to automatically deploy to username.github.io/reponame/ (e.g. https://dahlbyk.github.io/posh-git/ deployed from gh-pages).