Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Git Basics Workflows A Day in the Life of a Git Project

Laurie Gray
Laurie Gray
23,119 Points

If I use a service to deploy my site they only give me 5 repositories. How can I deploy my 100s of sites with only 5?

Okay, I totally understand Git commands and the benefits of using it. But whats not clear is deployment. Lets say I use beanstalk to upload and automatically deploy my work. They only offer 5 repositories for what they term as enough for a solo developer.

I assumed you would need ONE repository per ONE website to keep all commits and branches inside? How can I be a solo web developer with 100s of clients with only a handful of repositories?

Many thanks!

5 Answers

William Li
PLUS
William Li
Courses Plus Student 26,868 Points

How can I be a solo web developer with 100s of clients with only a handful of repositories?

If you need that many repos, but don't wanna pay more. Heroku maybe your best bet. It offers

Laurie Gray
Laurie Gray
23,119 Points

Hello William thank you for your answer. Can I just ask this then? So it is correct that you would have hundreds of repos for hundreds of sites? Is there a way of combining different sites into one repo which are deployed to separate domains as it were? Beanstalk offer 300 repos for 200 dollars per month but for 200 users. I only require a few users but if repos can't deploy more than one site then I don't know how else I would get round this. Thank you.

William Li
William Li
Courses Plus Student 26,868 Points

May I ask what kind of site you're trying to build for the client? Static site? Or heavily database driven sites using sth like Rails/Django?

Laurie Gray
Laurie Gray
23,119 Points

All of my sites are currently static: html, css, javascript. I still want to use version control though as some of my clients are sub contracting work to me and want to see my code as it develops.

William Li
William Li
Courses Plus Student 26,868 Points

Since your sites are all static, I really don't see why not. However, I am not familiar with beanstalk and what they allow/disallow your repo to do; give me a moment to take a look at their docs.

Laurie Gray
Laurie Gray
23,119 Points

So is there a way to have say 5 sites in one repo? Even if it wasn't beanstalk?

William Li
William Li
Courses Plus Student 26,868 Points

yes, of course. Just use different subdirectory under your git master directory for different site; in fact, you can even run multiple sites off multiple domains on a single server by setting up virtual host in Apache or server blocks in Nginx.

Laurie Gray
Laurie Gray
23,119 Points

Thanks William. Can I just go one step back. If I have only one repo and lets say 10 basic static sites, how do I make masters for each site in sub directories? I thought that was done when you used branches. Sorry for the basic questions its just deployment isnt really covered in these courses. (will look at nginx too thanks)

William Li
William Li
Courses Plus Student 26,868 Points

how do I make masters for each site in sub directories?

You don't, in the earlier comment about 1 git repo with multiple subdirectories for different sites, I was merely suggesting to use 1 master to keep track of them all; but the problem is obvious here, that contaminates your entire git commit history.

If you are indeed want to make each sub-directory a git repo of its own; there's sth called submodule in git, that does just that. Submodule is a big and complex topic on its own, I can't reasonably explain it in a comment, I'd suggest you take alook at this git doc http://git-scm.com/book/en/v2/Git-Tools-Submodules.

William Li
William Li
Courses Plus Student 26,868 Points

I understand that you're trying to get by the repo limit imposed by Beanstalk, but working with submodule can be very tricky sometimes; I'm not sure you wanna go there. Perhaps branching is a better alternative.

Laurie Gray
Laurie Gray
23,119 Points

Thanks William. So basically I could use github to have private repos (lots of them) and find my own manual way of deploying to make it cheaper in the meantime and learn about submodule as I go? Any advice on how to deploy sites manually?

William Li
William Li
Courses Plus Student 26,868 Points

Any advice on how to deploy sites manually?

I'm not sure what's best for you. Ages ago, I deployed my sites by FTP uploading; then I moved to Heroku, the git deployment was pretty nice; but I hate the restriction Heroku placed upon me; so I moved on to a VPS hosting service. Now I'm using DigitalOcean, and set it up with automatic git deployment, and I'm very happy about it.