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 --sharedand 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.gitNote, '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/headsI 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