From: Tim M. <tim...@gm...> - 2012-10-03 08:41:23
|
The short answer is to not have a bare repo on the thumb drive, so it is more practical to push from it, especially to your master repo. If you do that, you need to realize that the branch you have checked out into the working tree could be made out of date in odd ways by pushing into the repo. I usually get around that by pushing around branches that won't be checked out in the repo (i.e., other than master). A better alternative in your case might be to use git bundles, which pack into a file the data that would be on the wire in a git push. http://git-scm.com/2010/03/10/bundles.html seems well suited to your scenario. Tim On Wed, Oct 3, 2012 at 4:07 AM, Curtis Olson <cur...@fl...> wrote: > I know how everyone loves git questions here, so this is a bit off topic, > but I have another crazy git question. The situation is probably weird > enough that I might not be able to explain it well enough to get an answer, > but let me try. > > The situation is that I have a master git repository on my linux pc > (--bare). I then cloned it from multiple places and I can push and pull and > commit from any of the remote clones (the clones that have a working tree) > and everything works as expected. > > Now I'd like to also be able to pull and push and make changes (and keep in > sync) on a computer that is impossible to have on the network (it's an > embedded linux computer that has no network hardware and no way to add any.) > The embedded linux computer has a full copy of git and a full native > development system right on board. > > I am able to plug in a USB thumb drive, so my "brilliant" idea was to create > a clone of the master repository on the thumb drive. The clone on the thumb > drive is setup so it's remote path is valid when it is plugged into my main > linux desktop PC and can see the master repository from there. > > I have a clone of the repository on my embedded system too, and it's remote > is setup to point to the clone on the thumb drive when that is plugged in. > So I can plug the thumb drive into my main linux computer and run pull/push > against the master repository, or I can plug the thumb drive into the > embedded system and do pulls/pushes from the local embedded system with the > repository on the thumb drive acting as the remote master. Then if there > are changes from the embedded system, I can move the thumb drive over to the > linux desktop PC, go to the thumb drive repository and run a push from there > to get the changes back into the master central repository ... that was my > theory at least and I though I had it working until I started pushing > changes around from a few different directions. > > The clone on the thumb drive was originally just a simple clone with a > working tree, but I ran into problems making that the remote for my embedded > clone, so I went back and remade the thumb drive clone using the --bare > option. But now I'm in a situation where I have changes from the embedded > system that I've pushed into the thumb drive repository. And I have changes > from elsewhere that I've pushed into the master repository. > > If I "cd" to the thumb drive repository and run git push (which I thought > would push my changes to the master repository) I get the following error: > > $ git push > To /path/myrepo.git/ > ! [rejected] master -> master (non-fast-forward) > error: failed to push some refs to '/path/myrepo.git/' > hint: Updates were rejected because the tip of your current branch is behind > hint: its remote counterpart. Merge the remote changes (e.g. 'git pull') > hint: before pushing again. > hint: See the 'Note about fast-forwards' in 'git push --help' for details. > > However, my thumb drive repository is created with the --bare option so I > don't have a working tree, thus when I run "git pull" as per the suggestion > in the error message I get: > > $ git pull > fatal: /usr/libexec/git-core/git-pull cannot be used without a working tree. > > This may not make any sense the way I'm explaining it, or maybe I'm missing > something completely obvious? But essentially I'm trying to work around not > having a network connection by creating a go-between repository clone on a > thumb drive. Is this possible? > > BTW, I looked at git clone --mirror, but I need to pass changes in both > directions to/from the embedded system through the thumb drive repository so > I don't think a pure mirror of the master repository will do what I want. > > Any suggestions? > > Thanks, > > Curt. > -- > Curtis Olson: > http://www.atiak.com - http://aem.umn.edu/~uav/ > http://www.flightgear.org - http://gallinazo.flightgear.org > > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > _______________________________________________ > Flightgear-devel mailing list > Fli...@li... > https://lists.sourceforge.net/lists/listinfo/flightgear-devel > |