[kwlug-disc] how to start and use a shared git repo in place?

Kyle Spaans 3lucid at gmail.com
Tue Feb 23 10:23:58 EST 2010


On Tue, Feb 23, 2010 at 8:57 AM, Darcy Casselman <dscassel at gmail.com> wrote:
> On Tue, Feb 23, 2010 at 6:23 AM, Robert P. J. Day <rpjday at crashcourse.ca> wrote:
>>  at this point, what's the preferred method of working with this
>> content/repo if i want to be able to make changes/adds, commits, but
>> also be able to checkout back to earlier commits *and* share that repo
>> with others?

Assuming you are sharing the repo on the local computer (or at least the
local computer will be the host if you're sharing over a network), then you
need a *bare* repo. A bare repo contains all of the git data and metadata
but no working directory. You need to create it in a separate directory (so
you can keep the directory that you've already created):

$ cd ~/sysco-bare
$ git init --bare
$ cd ~/sysco
$ git push ~/sysco master # this will "initialize" the bare repo
$ git remote add shared ~/sysco # so that you don't have to specify the URL
$ ... # edit your local repo
$ git push shared master
$ ... # someone else clones and pushes to shared repo
$ git pull shared master

> I think you can also use 'git push' to create a shared repository
> somewhere that other users can get at it.

Yes, you'll need to put the bare repo somewhere where other users can
access it (in your case, read/write).

> Look at 'git push', 'git pull' and 'git merge'.

Merging will be necessary if you're working simultaneously with someone
else: one of you will have to merge your work with the other's before you
can commit back to the shared repo.

gl & hf




More information about the kwlug-disc mailing list