Reputation: 127
I'm new to git so please feel free to RTFM me...
I have multiple development sites (none of which can communicate via a network with each other) and am working on a few projects (with a few people) at any one time.
What I would ideally have is at each site a centralized repository that can be pulled from but development would occur in our own (personal) repos. Then I would like to be able to sync across the centralized repos (via USB key for example).
I want a centralized repo at each location as (1) I'm new to git and do break my (personal) local repo by playing around and (2) some projects get put on hold so I want to be able to free up disk space by deleting them. This is the "backup" part of my question.
I was also hoping to be able to use 'git clone --bare' for my centralized repos (and the USB key repos to?) as we don't need the full checkout, just the git benefits.
However I can't seem to get a bare repo to work as repo I can push from. I've used 'git remote' to set up an remote origin (similar to http://toolmantim.com/thoughts/setting_up_a_new_remote_git_repository) but I can't get 'git push' to work - it seems I need a checked-out repo.
.
Does anyone else use this sort of repo/development structure or is there something fundamental about git usage that I'm missing?
.
A solution that I thought about that might not work - If I had a 'git clone --bare' at each site and then use a git repo on my removable media which has remotes set up for each site then I could ('pull') sync my USB key with each repo. But then can I update the site repo from my USB key? Could I push from USB?
Upvotes: 4
Views: 2040
Reputation: 1323973
Another solution when it comes to backup from which you can pull from is:
That way, you have:
Note: you are lucky to be able to use USB key. At our company, those USB port were blocked a long time ago;) Another "security" (big double quotes) measure...
Upvotes: 0
Reputation: 76500
OK, let me just start off by saying that the whole premise of security by not being able to connect to the internet is completely misplaced. I shouldn't be judging without knowing all the facts, but considering the fact that you are asking this kind of basic question on StackOverflow means you are not a multi-national corporation developing a next generation of rail-guns and is under constant hacker attack.
Depriving developers of internet connection improves security by about 0.01% and slows them down as they can't research relevant stuff by about 1000%. You need to start off by advocating a better environment to whoever is in charge and have a hosted repository on a server somewhere. You can pay for a private github repository or roll out your own git repo on linux using gitorious or gitosis.
As for the actual problem. Instead of pushing from your bare repository, all you do is pull into it. You are on the right track with the last paragraph.
This is a good solution in theory but you would find that you will at some point get conflicts when syncing repos. In that case the developer needs to resolve those conflicts.
A better solution would be to not have the site repository. Because the whole repository is contained in a directory, you can make as many copies of it locally as you want. This will also address your "playing around" concern.
If the developers need to share code, they can just pull from each other. Then the USB stick comes in and they pull/push their changes. This way the people who create conflicts are the ones responsible for merging.
Let me again reiterate how much of a productivity burden this will be. It's hard enough to have a single shared repository with multiple people involved. With the time delay of manually synchronising the sites chances are if there is a bug, it won't be fixed today, but the day after.
Upvotes: 2