3

I pull'ed some public repository, made few changes here and there. I committed them to my local copy. I regularly pull from remote to get changes from the public repo. Occasionally, I work on that local copy from different PC's and I need to move entire source code between PCs so that they share exactly the same changes. A few times I messed up copying and lost some of my local changes. So my question is: how can I set up some sort of local git server on one of the PCs so that I could still pull changes from that public repo and commit my local changes to my local git server so that I would be able to synchronize my work between multiple PCs without copying full source three?

I use Windows

Pavel P
  • 15,789
  • 11
  • 79
  • 128

3 Answers3

3

Remember that a git repository is ultimately just a set of files on disk.

You can put your main local git repository on a network share and then push / pull with repos on other computers on the same LAN.

This has worked well for me in the past (main repo on a server, other repos on laptops, desktop PCs etc.)

mikera
  • 105,238
  • 25
  • 256
  • 415
  • Yes, exactly! A git repository is just the set of files stored locally. Having access to the folder accessable to other computers on the network will accomplish this. Yes, I did suggest dropbox, as it does allow multiple computers to share the same files. However, creating a shared folder accomplishes this as well. I actually like your method better than mine. – Henrey Bellchester Aug 26 '12 at 01:55
  • I'm using git for a couple years mainly for local repos to track my changes and I use svn as a server at work. I want to share that huge git repo between PC that aren't on the same lan and the size of the repo is huge (500MB, but changes are minor). So, I really think that I need some kind of git server setup on one of the PC's so that I could push there all my changes and then pull them on the other PC. At the same time I want to be able to pull changes from the original repo. – Pavel P Aug 26 '12 at 01:56
  • @HenreyBellchester the repo is 500MB in size. Changes are usually only a few KB in size. Not sure how well dropbox would handle these kind of changes. Would it trasmit only changes or entire changed files that could be big in size. Plus, sometimes I might have local changes at home that I didn't finish working on and I'd like to continue on these changes before accepting new changes from my work pc. SO, I want to be able to control manually when to pull changes and when to commit. – Pavel P Aug 26 '12 at 02:00
1

You can also just host your fork of the project on any of the popular git hosters (GitHub, gitorious) and add them as a new remote. Then use this repository as your base.

You also should try to get your patches back into mainline. This safes you exactly that pain and helps others.

pmr
  • 58,701
  • 10
  • 113
  • 156
  • this is project that devs don't like to patches. I've wasted hours to prepare them, some were accepted, some were ignored for minor reasons. So I gave up on trying to share changes, especially most of them are related to supporting broken compilers (as they call MS compiler). And I can't put it on github, because there is a minot part of code that isn't mine and I can't make it public. – Pavel P Aug 26 '12 at 01:52
  • @Pavel As I said: Any of the hosters. Some of them allow `private` repositories. – pmr Aug 26 '12 at 02:15
0

You can set your git repository inside of a dropbox that way all changes will be shared amongst all the computers you have

  • Isn't that sort of defeating the purpose of having a git repo? –  Aug 26 '12 at 01:43
  • dropbox or sugarsync are alternatives that I'm well aware of, but it's kind of not the way to do it. – Pavel P Aug 26 '12 at 01:51
  • 2
    Been there, tried that, failed miserably. Sometimes when Git changes a file in a Dropbox folder, Dropbox gets confused and thinks that the master version online is the "correct" version and it undoes the change that Git made. Next thing you know, Git thinks that a bunch of files you thought were under version control are untracked. DON'T DO THIS!!! – Bob.at.Indigo.Health May 11 '14 at 16:01