1

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/ )

Hugolpz
  • 17,296
  • 26
  • 100
  • 187
  • 1
    Sounds like you're looking for git submodules. – Ben Hymers Jan 06 '15 at 15:25
  • According to [Using submodules with Pages](https://help.github.com/articles/using-submodules-with-pages/) : "If your repository contains [submodules](http://git-scm.com/book/en/v2/Git-Tools-Submodules), they will automatically be pulled in when the Page is built." – Hugolpz Jan 06 '15 at 15:57
  • @Hugolpz, it doesn't look like you've configured your audio repository as a submodule yet. – ChrisGPT was on strike Jan 06 '15 at 16:08
  • I haven't yet. I'am looking for that as well. (reading docs online) – Hugolpz Jan 06 '15 at 16:10
  • @Chris: the answer is `git submodule add -- "https ://github.com//AUDIO.git " "./audio/" . If you want to add this as an answer I will be happyt to validate it :) – Hugolpz Jan 06 '15 at 16:16
  • @Hugolpz, you did most of the work on this one. Why not [add the answer yourself](http://stackoverflow.com/help/self-answer)? – ChrisGPT was on strike Jan 06 '15 at 16:25
  • I was not aware self-answering was encourage and well received... Thanks for the hint. – Hugolpz Jan 06 '15 at 16:34

2 Answers2

2

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
Hugolpz
  • 17,296
  • 26
  • 100
  • 187
  • See also : http://stackoverflow.com/questions/4604486/ for add & remove submodules. – Hugolpz Jan 06 '15 at 17:24
  • `git config --get remote.origin.url` may also help you to identify the submodule's url. – Hugolpz Jan 19 '15 at 22:33
  • To syn the local and remote, you could also do `git push --mirror` or more aggressive ways, see [Delete a Git branch both locally and remotely](http://stackoverflow.com/a/13437928/1974961) – Hugolpz Jan 23 '15 at 22:31
1

With Github pages, you can simply do :

Main website

Hosted on github.com/userName/username.github.io. Eventually with a custom domain name.

Is reached with username.github.io or cutom domaine name.

Audio files

Hosted on github.com/userName/audio.

Is reached with username.github.io/audio

Local development

The main site can .gitignore audio folder which itself host the audio repository. This will replicate online folder hierachy.

Hugolpz
  • 17,296
  • 26
  • 100
  • 187
David Jacquel
  • 51,670
  • 6
  • 121
  • 147