Search code examples
githubgithub-pages

Using n github repositories for a single github-page website?


I'am coding a website which stands on 2 github repositories : WEBSITE.git (2MB or 2%) & AUDIO.git (98MB = 98%). I deploy it as follow :

git clone https://github.com/<user>/WEBSITE.git
mkdir -p ./audio ./audio/cmn;
git clone https://github.com/<user>/AUDIO.git ./audio/

After deploiement the structure is then such as :

|- /html/<files>
|- /css/<files>
|- /js/<files>
|- /audio/<AUDIO.git's files>

Repository AUDIO is 98% of the project weight (100MB) from a dynamic open sourve project, WEBSITE is my 2% of codes.

Naturally, when I add a git checkout --orphan gh-pages to WEBSITE.git, the gh-pages http(s)://<user>.github.io/WEBSITE/ website works but doesn't have the audios. All as we can expect.

I need the audios to works, the easy way would be to integrate fully these audios to WEBSITE.git. But I'am quite reluctant to add such heavy files to its git's history since it will dramatically increase the weight of my html/css/js repository by a factor 50. It matters since I'am teaming up with a dev who have very low internet connection.

How should I process ? Is there some secret hack to integrate an external github repository to a gh-pages files structures? (plug AUDIO.git to http(s)://.github.io/MYSITE/audio/ )


Solution

  • Github page

    Since 2017, user Configuring a publishing source for GitHub Pages from github's settings.

    Git submodules

    # Get project
    git clone "https://github.com/<user>/WEBSITE.git"  # clone your project
    cd ./WEBSITE/                                      # move in
    ## Add submodule to target folder
    git submodule add -- "https://github.com/<user>/AUDIO.git" "./audio/" 
    ## Commit changes 
    git commit -am "dev,git: add submodule https://github.com/<user>/AUDIO.git" 
    git push
    ## Update/Install submodules locally
    git submodule update --init --recursive
    

    Cloning and updating repository

    Cloning the repository with submodules for git 1.6.5+ :

    git clone --recursive git://github.com/foo/bar.git
    cd bar