Using a single git repository for multiple git projects

I’m cheap. I don’t want to pay for many github accounts.

I have a project structure which looks something like this.

  • /repo is the project root.
  • /repo/project1 is where I have a Java project
  • /repo/herokurails1 is where I have a Ruby/Rails project which deploys to (to a heroku app called
  • /repo/herokurails2 is where I have another Ruby/Rails project which deploys to (to a heroku app called

All projects (project1, herokurails1, and herokurails2 are under active development).

I would like to have one repository at some git hosting place such as or even a local git server in the office. Whenever code changes anywhere in /repo/, I want to be able to run “git push github master” and have my entire /repo/ tree pushed up to github.

However, I would also like to be able to deploy my rails apps to without pushing the entire repo/* tree pushed to each heroku app. e.g.

  • /repo/herokurails1> git push heroku master would only deploy the herokurails1 project to heroku without pushing up any other code in /repo/*
  • /repo/herokurails2> git push heroku master would only deploy the herokurails2 project to heroku also without pushing up any other code in /repo/*.

Is this possible? Do I need to set up anything special to make this happen? Or am I stuck with multiple git repositories?

  • Cannot push to heroku - bundler fails
  • Git checkout <SHA> and Heroku
  • Proper install dependency by requirements.txt or how to properly install dependency which was edited
  • Error deploying Play Framework 2.4 on Heroku
  • Heroku Java app crashing locally but not on the web
  • git remote doesn't seem to be working at all
  • error: library dfftpack has Fortran sources but no Fortran compiler
  • Heroku rejects my git push request
  • 4 Solutions collect form web for “Using a single git repository for multiple git projects”

    This is going to get very unwieldy very quickly (especially as Git won’t let you push pull sub directories like svn will)

    I would look at not using Github for storing projects. Tools such as Bitbucket or CodebaseHQ have different pricing models which may well fit you better and give you the simplicity you need.

    Alternatively, look at something like Gitosis, which can be made to be very Github-esque via tools like Gitlab

    You could use git subtree locally to maintain a git repository which is split from your larger repo repository, and push from that split repository. Frankly, though, I’d either use one of the free services that Adam Dymitruk suggests or just pay GitHub a bit more – they do provide an excellent service, after all…

    If you want, you could use unfuddle or bitbucket if you don’t want to pay anything. Use submodules to host large files such as images, 3rd party dlls, videos, etc on github. These would hold no IP.

    how about putting every separate project in a different branch ? it worked fine with me so far. I have a private repo for webProjects and every branch starts with master which has my web projects template (could be empty branch as well) and every time I have new project I just create a master based branch with the project name and cary on working fine.

    Git Baby is a git and github fan, let's start git clone.