gpt4 book ai didi

python-3.6 - 使用GitPython检索Github存储库名称

转载 作者:行者123 更新时间:2023-12-03 15:21:40 26 4
gpt4 key购买 nike

有没有办法使用GitPython获取存储库名称?

repo = git.Repo.clone_from(repoUrl, ".", branch=branch)

我似乎找不到任何附加到具有此信息的 repo 对象的属性。可能是我误解了github/GitPython的工作方式。

最佳答案

我可以建议:

remote_url = repo.remotes[0].config_reader.get("url")  # e.g. 'https://github.com/abc123/MyRepo.git'
os.path.splitext(os.path.basename(remote_url))[0] # 'MyRepo'

关于python-3.6 - 使用GitPython检索Github存储库名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55132481/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com