2

I want to be able to get a URL like https://github.com/user/repo.git given a remote name such as origin. So far I have only managed to get the commit hash:

>>> from dulwich import porcelain
>>> hash = porcelain.ls_remote('.')[b'refs/remotes/origin/master']
Dull Bananas
  • 892
  • 7
  • 29

1 Answers1

2

At the moment, there is no porcelain wrapper for this. With the plumbing, you can use:

>>> from dulwich.repo import Repo
>>> config = Repo('.').get_config()
>>> config.get(('remote', 'origin'), 'url')
b'git://jelmer.uk/dulwich'
jelmer
  • 2,405
  • 14
  • 27