{"thread":{"id":"9223","subject":"easy repository initialization that turned out not to be that easy","startedAt":"2007-07-25T20:05:10Z","lastAt":"2007-07-25T20:15:29Z","messageCount":2,"participants":["Steffen Prohaska","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"48583","messageId":"0EAD32C5-11DA-4B99-919D-87C0006A389C@zib.de","threadId":"9223","inReplyTo":null,"subject":"easy repository initialization that turned out not to be that easy","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2007-07-25T20:05:10Z","receivedAt":"2007-07-25T20:05:10Z","isPatch":false,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"I stumbled about some tasks that I expected to be easy but\nturned out not to be that easy ...\n\n(with git version 1.5.3.rc2.29.gc4640f)\n\n\n1) How can I switch a private repository to shared as if it\nwas created by 'git-init --shared' in the first place?\n\nJust executing 'git-init --shared' in the repo doesn't\nadjust permissions as needed.\n\nCloning it to shared doesn't work either because the meaning\nof 'git-clone --bare --shared' is different from\n'git-init --shared'.\n\nSo I created a fresh repository\n\n    mkdir shared.git\n    cd shared.git\n    git --bare init --shared\n\nand tried to naively fetch all by executing\n\n    git fetch ../private.git\n\nHmm... it does a lot of things, but I ended without branches.\nfetch apparently has nothing like '--all'.\n\n... but push has, so I finally did\n\n    cd ../private.git\n    git push --all ../shared.git\n    git push --tags ../shared.git\n\nNote, 'git push --all --tags' refused to work, so I needed\nto push branches and tags separately.\n\nIs it really that hard, or did I miss something?\n\n\n2) How can I set up an empty bare repository that shares\nobjects with an existing repository? I'd like to do that\nto save space and bandwidth.\n\nI started to search for something like 'git init --reference'\nor 'git init -l', similar to what 'git clone' provides.\n\nI don't remember all approaches I tried, but finally I used\n\n    git clone --bare -l existing.git new.git\n    cd new.git\n    mv refs/head/master .\n    rm -rf refs/heads/* refs/tags/*\n    mv master refs/heads\n\nI remember that I needed to leave the master in place because\notherwise a 'git push' didn't recognize that objects are already\npresent and transferred everything, which is quite annoying over\na slower network connection. With master in place the first push\nto new.git worked as expected. Only the additional objects were\nsent.\n\nDid I miss something?\n\n\tSteffen\n"},{"id":"48585","messageId":"Pine.LNX.4.64.0707252112250.14781@racer.site","threadId":"9223","inReplyTo":"0EAD32C5-11DA-4B99-919D-87C0006A389C@zib.de","subject":"Re: easy repository initialization that turned out not to be that easy","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-07-25T20:15:29Z","receivedAt":"2007-07-25T20:15:29Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 25 Jul 2007, Steffen Prohaska wrote:\n\n> Cloning it to shared doesn't work either because the meaning of \n> 'git-clone --bare --shared' is different from 'git-init --shared'.\n\nYes, I lamented on that already.  But we cannot change that.  Too many \nusers.\n\n>    mkdir shared.git\n>    cd shared.git\n>    git --bare init --shared\n> \n> and tried to naively fetch all by executing\n> \n>    git fetch ../private.git\n\nAlmost.  \"git fetch\" does not store anything by default, so you have to do \nsomething like\n\n\t$ git config remote.origin.url ../private.git\n\t$ git config remote.origin.fetch 'refs/*:refs/*'\n\t$ git fetch\n\nEventually, I would like that to be available with\n\n\t$ git remote add --mirror fetch ../private.git\n\nIf nobody beats me to it, I'll do it later today.\n\nCiao,\nDscho\n"}]}