git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* easy repository initialization that turned out not to be that easy
@ 2007-07-25 20:05 Steffen Prohaska
  2007-07-25 20:15 ` Johannes Schindelin
  0 siblings, 1 reply; 2+ messages in thread
From: Steffen Prohaska @ 2007-07-25 20:05 UTC (permalink / raw)
  To: Git Mailing List

I stumbled about some tasks that I expected to be easy but
turned out not to be that easy ...

(with git version 1.5.3.rc2.29.gc4640f)


1) How can I switch a private repository to shared as if it
was created by 'git-init --shared' in the first place?

Just executing 'git-init --shared' in the repo doesn't
adjust permissions as needed.

Cloning it to shared doesn't work either because the meaning
of 'git-clone --bare --shared' is different from
'git-init --shared'.

So I created a fresh repository

    mkdir shared.git
    cd shared.git
    git --bare init --shared

and tried to naively fetch all by executing

    git fetch ../private.git

Hmm... it does a lot of things, but I ended without branches.
fetch apparently has nothing like '--all'.

... but push has, so I finally did

    cd ../private.git
    git push --all ../shared.git
    git push --tags ../shared.git

Note, 'git push --all --tags' refused to work, so I needed
to push branches and tags separately.

Is it really that hard, or did I miss something?


2) How can I set up an empty bare repository that shares
objects with an existing repository? I'd like to do that
to save space and bandwidth.

I started to search for something like 'git init --reference'
or 'git init -l', similar to what 'git clone' provides.

I don't remember all approaches I tried, but finally I used

    git clone --bare -l existing.git new.git
    cd new.git
    mv refs/head/master .
    rm -rf refs/heads/* refs/tags/*
    mv master refs/heads

I remember that I needed to leave the master in place because
otherwise a 'git push' didn't recognize that objects are already
present and transferred everything, which is quite annoying over
a slower network connection. With master in place the first push
to new.git worked as expected. Only the additional objects were
sent.

Did I miss something?

	Steffen

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: easy repository initialization that turned out not to be that easy
  2007-07-25 20:05 easy repository initialization that turned out not to be that easy Steffen Prohaska
@ 2007-07-25 20:15 ` Johannes Schindelin
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Schindelin @ 2007-07-25 20:15 UTC (permalink / raw)
  To: Steffen Prohaska; +Cc: Git Mailing List

Hi,

On Wed, 25 Jul 2007, Steffen Prohaska wrote:

> Cloning it to shared doesn't work either because the meaning of 
> 'git-clone --bare --shared' is different from 'git-init --shared'.

Yes, I lamented on that already.  But we cannot change that.  Too many 
users.

>    mkdir shared.git
>    cd shared.git
>    git --bare init --shared
> 
> and tried to naively fetch all by executing
> 
>    git fetch ../private.git

Almost.  "git fetch" does not store anything by default, so you have to do 
something like

	$ git config remote.origin.url ../private.git
	$ git config remote.origin.fetch 'refs/*:refs/*'
	$ git fetch

Eventually, I would like that to be available with

	$ git remote add --mirror fetch ../private.git

If nobody beats me to it, I'll do it later today.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-07-25 20:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-25 20:05 easy repository initialization that turned out not to be that easy Steffen Prohaska
2007-07-25 20:15 ` Johannes Schindelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).