nCardot
nCardot

Reputation: 6595

Adding existing repo as a page on GitHub Pages

To add a page for a live project from GitHub to my GitHub Pages site I've been copying the contents of each repo folder into the repository for my GitHub Pages site then linking to it from index.html. If I want to make a change to an old repo/project, I have to update it in both places, which is repetitive. Is this the easiest way to do it, or is there a better way (like linking directly to the original repository if it's already on GitHub)?

Upvotes: 2

Views: 1190

Answers (1)

Damien
Damien

Reputation: 684

You can use git submodule. In the GitHub Pages repository, simply run this command in the directory you'd like it referenced:

git submodule add https://github.com/<user>/<repository>

When you need to update these references (after you update the repositories), you simply execute:

git submodule update --init --recursive

Upvotes: 4

Related Questions