Skip to content

Questions: what is the dulwich equivalent of git remote -v? #946

Answered by jakeogh
dclong asked this question in Q&A
Discussion options

You must be logged in to vote

This is close, I think (push) is just assumed? I don't see any push records in the config.

$ cat git_remote_v.py 
#!/usr/bin/env python3

import sys
from dulwich.repo import Repo
repo = Repo(sys.argv[1])

for config_file in repo.get_config_stack().backends:
    for k, v in config_file.items():
        #print(f'{k=}', f'{v=}')
        if k[0] == b"remote":
            print(k[1].decode("utf8"), v[b"url"].decode("utf8"))


$ ./git_remote_v.py ~/cfg/_myapps/qcodes
origin [email protected]:jakeogh/Qcodes.git
upstream https://github.com/QCoDeS/Qcodes

$ cd ~/cfg/_myapps/qcodes

$ git remote -v
origin  [email protected]:jakeogh/Qcodes.git (fetch)
origin  [email protected]:jakeogh/Qcodes.git (push)
upstr…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by jelmer
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #896 on February 18, 2022 16:36.