← Back to team overview

dulwich-users team mailing list archive

Cloning/Pulling from a Remote Git Repository

 

I'm currently trying to use dulwich to pull or clone from a remote Git
repository.  I've been working through the API, /usr/bin/dulwich, and
the source, but have got stuck.

What I have so far (assuming a git-daemon running on
git-server.example.com):

#######

from dulwich.repo import Repo
from dulwich.client import TCPGitClient

src = "/git/test"
target = "/tmp/repo"

client = TCPGitClient("git-server.example.com")

os.mkdir(target)
Repo.init(target)
r = Repo(target)

graph_walker = r.get_graph_walker()
determine_wants = r.object_store.determine_wants_all

f, commit = r.object_store.add_pack()
client.fetch_pack(src, determine_wants, graph_walker,
                                   f.write, sys.stdout.write)

commit()

########


This is as far as the example in /usr/bin/dulwich goes (for cloning).
This results in a pack file in .git/objects/pack/, but I can't find a
way of extracting this pack file to make the repository 'useable', and
I'm not sure how to update the refs for the target repository once this
has been done (something with repo.refs ?)

Can someone give me some pointers on how to do a pull from a remote
repository?

Thanks,

Matthew

Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups