Adrian Krupa
Adrian Krupa

Reputation: 1937

Cloning git bundle over http(s)

Is it possible to clone git bundle over http? When I try to do this i got:

$ git clone http://127.0.0.1:8888/repo.bundle
Cloning into 'repo.bundle'...
fatal: repository 'http://127.0.0.1:8888/repo.bundle/' not found

The reason to do that is to avoid compressing repository on the server (just serve file) and we are limited to git clone by user's application

Upvotes: 4

Views: 399

Answers (1)

Mark Adelsberger
Mark Adelsberger

Reputation: 45789

I know of no way to do what you ask. The original purpose of bundles is to compensate for cases where "online" access to a repo (e.g. an HTTP connection, among other things) isn't available; so I doubt that any thought would have been given to a use case like this.

I gather what you want is to prepare a subset of the repo that you anticipate needing to transfer, so that requests for that subset don't incur costs to either transfer additional data or separate what's needed from what's not. In that case, you might consider preparing a shallow clone instead of a bundle. Note that the history for each head to be fetched from a shallow clone must include at least one commit already in the repo doing the fetch. So for example, if you have

x -- x -- ... huge history ... -- O -- x -- x <--(master)
                                   \
                                    A -- B -- C <--(some_branch)

and you're wanting to share A through C in this way, you would

git clone --depth=4 -b some_branch url/of/origin some_branch_repo

Because depth is 4, this will include O, A, B, and C -- meaning that a fetch of some_branch can receive A through C.

Upvotes: 1

Related Questions