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.
- How do you prevent Git from printing 'remote:' on each line of the output of a post-recieve hook?
- I could not deploy to Heroku
- Specify '--remote' Heroku app based on git branch
- Heroku: “No default language could be detected for this app” error thrown for node app
- Getting started with Heroku- git push heroku master hangs indefinitely?
- Deploy my app on heroku
- /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?
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.