Can "git fetch" be told not to use "git upload-pack" for local repositories?
When using git fetch
to fetch refs from one (very large) repository to another one on the local machine, git upload-pack
takes a very long time to create pack files. In the local case there's not such a need to minimize the amount of data transported, and I don't care about disk space lost by losing delta compression, so ideally I'd prefer for the missing objects to be copied rather than packed and then imported. Is there any way to tell git fetch
to just copy the missing objects when using the local transport?
Or, more generally, is there a way to suppress the generation of pack files globally? Really I just want to use git as a versioned filesystem that doesn't use up extra space for identical files - packing and repacking seems to be the time-consuming step that makes this awkward.
Incidentally, I've spent some time trying to optimize config options so that repacking doesn't take so long (nor start thrashing) so I don't think the answer is "use these config options and packing will happen much faster" - however, perhaps I've got that all wrong, so just t开发者_如何学编程o be clear, the config options that I'm typically using (on a maching with 2 GiB of RAM) are:
core.deltacachesize=1
core.packedgitwindowsize=16m
core.packedgitlimit=128m
pack.packsizelimit=512m
pack.windowmemory=200m
pack.deltacachesize=200m
pack.window=4
pack.compression=3
pack.threads=0
gc.auto=0
gc.pruneexpire=never
receive.autogc=false
Perhaps you could use alternates (alternate object storage) mechanism; this would allow sharing object database with other local repository, and then not having to pack them.
To set up this, use 'git clone' using either --shared
option if cloning from local repository, or --reference <repository>
if cloning from remote repository but when you have similar repository locally, or just edit .git/objects/info/alternates
file.
I have a repository that plain old git clone
will not clone:
$ git clone $url
Cloning into foo...
remote: Counting objects: 6142, done.
error: pack-objects died of signal 9839/6058)
error: git upload-pack: git-pack-objects died with error.
fatal: git upload-pack: aborting due to possible repository corruption on the remote side.
remote: aborting due to possible repository corruption on the remote side.
fatal: early EOF
fatal: index-pack failed
Although it's concealed by the progress text which it overwrite, the failing error message is error: pack-objects died of signal 9
.
I was able to prevent the error by disabling packing on the client side. I did this by issuing a sequence of commands (issued with git 1.7.4.1) that basically do what git clone
does, but with an extra command to set pack.depth
to 0
before running git fetch
.
mkdir foo
cd foo
git init
git remote add origin $url
git config pack.depth 0
git fetch origin
git branch --set-upstream origin origin/master
git checkout master
Maybe (not tested) setting up a http-backend
for your first repo (the one from which you are fetching).
This kind of server has a setting which could be of interest in your case:
http.uploadpack
This serves
git fetch-pack
andgit ls-remote
clients.
It is enabled by default, but a repository can disable it by setting this configuration item to false.
精彩评论