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.

  • GIT on push to a remote server exlude folders/files
  • Makefile error: Unexpected end of line seen
  • What does git fetch exactly do?
  • Issue in automatic executing post-commit in git hook to sync local and remote directory
  • Git Submodule - Permission Denied
  • Git: How to fetch a single remote branch and create a remote-tracking branch of it automatically?
    • /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 heroku.com (to a heroku app called hr1-fubar.heroku.com)
    • /repo/herokurails2 is where I have another Ruby/Rails project which deploys to heroku.com (to a heroku app called hr2-fubar.heroku.com).

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

    I would like to have one repository at some git hosting place such as github.com 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 heroku.com 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?

  • Rollback to an old commit using revert multiple times
  • ERROR: Repository not found message given when following the instructions for Jekyll-Bootstrap
  • Where does Github desktop install command line version of Git
  • Can I run a password-protected, read-only git server?
  • How to get over Homebrew Git conflicts?
  • Combine changes across files
  • 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.