Skip to content

Instantly share code, notes, and snippets.

@jpleau
Last active August 29, 2015 14:04
Show Gist options
  • Save jpleau/19f0a64c49bc6bdfdc01 to your computer and use it in GitHub Desktop.
Save jpleau/19f0a64c49bc6bdfdc01 to your computer and use it in GitHub Desktop.
from dulwich.repo import Repo
from dulwich import client
from dulwich.client import ParamikoSSHVendor
from dulwich.client import get_transport_and_path
SSH_URI="my@host.com/var/git/pkg/packages.git"
p = "/home/oxez/pkg/packages"
r = Repo(p)
client.get_ssh_vendor = ParamikoSSHVendor
git_client, remote_path = get_transport_and_path(SSH_URI)
git_client.ssh_kwargs = {
'key_filename': '/home/oxez/.ssh/id_rsa.pub',
'port': 4321
}
remote_refs = git_client.fetch("/", r)
Traceback (most recent call last):
File "git.py", line 18, in <module>
remote_refs = git_client.fetch(".", r)
File "/usr/local/lib/python3.4/dist-packages/dulwich/client.py", line 209, in fetch
path, determine_wants, target.get_graph_walker(), f.write,
File "/usr/local/lib/python3.4/dist-packages/dulwich/repo.py", line 294, in get_graph_walker
heads = list(self.refs.as_dict('refs/heads').values())
File "/usr/local/lib/python3.4/dist-packages/dulwich/refs.py", line 150, in as_dict
ret[key] = self[("%s/%s" % (base, key)).strip("/")]
File "/usr/local/lib/python3.4/dist-packages/dulwich/refs.py", line 221, in __getitem__
_, sha = self._follow(name)
File "/usr/local/lib/python3.4/dist-packages/dulwich/refs.py", line 201, in _follow
while contents.startswith(SYMREF):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment