Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Wednesday, April 20, 2016

How two laptops can git push/pull to each other with no internet

How two laptops can git push/pull to each other with no internet


Say my co-hacker and I find ourselves on a desert island. Normally we push and pull to github to sync with each other. How would you recommend we do so when we have no connection to the outside world?

(User @bee and I actually have that problem as I type this, though obviously not as I send this. In our case we both have Mac laptops -- OSX Snow Leopard -- but I think it would be better to treat this question generically.)

Answer by Roy for How two laptops can git push/pull to each other with no internet


Running a git server locally should work if you're on the same network. One would push to his own machine, the other to the other machine (based on local IP).

Answer by Dave G for How two laptops can git push/pull to each other with no internet


For starters - get this book - http://book.git-scm.com/

Indispensable

Second, there is a section on page 40 titled Distributed Workflows

That should cover what you need, just use ssh as your comms protocol (assuming you're familiar with ssh from command line)

Answer by hammar for How two laptops can git push/pull to each other with no internet


The simplest solution is probably to just set up an ad-hoc wireless and SSH to eachother's laptops. You can set up your remote with

$ git remote add cohacker myuser@cohackers-laptop:/path/to/repo.git  

Now you can push/pull to your heart's content:

$ git pull cohacker master   ... hack away ...  $ git push cohacker master  

Answer by KingCrunch for How two laptops can git push/pull to each other with no internet


Take a SD-Card, or an USB-stick or something. Create a bare repository there. Then one push to that repo, unmount the card/stick, give it to the other, that one pull from it.

cd /path/to/usbstick  mkdir repo  cd repo  git init --bare  cd /path/to/local/repo  git remote add usb /path/to/usbstick/repo  git push usb --all  

One the other machine

cd /pat/to/local/repo  git remote add usb /path/to/usbstick/repo  git fetch usb --all  

Answer by VonC for How two laptops can git push/pull to each other with no internet


One solution compatible with your scenario would be to share through an USB stick one file through git bundle

That allows you to:

  • consider that one file (the 'bundle') as an upstream repo to which each user can update said bundle, and from which they can fetch new commits.
  • avoid trying to synchronize a large collection of files/meta data within a bare repo structure.
  • don't rely on any network/server process whatsoever.


Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.