【问题标题】:how to fetch git remote url using grgit APIs如何使用 grgit API 获取 git 远程 url
【发布时间】:2021-05-07 13:30:28
【问题描述】:

我需要使用 grgit API 在我的 groovy 脚本中读取具有以下 git 远程 url 的 .git 文件夹。

url = git@github.com:***/****.git

请帮忙

【问题讨论】:

    标签: git-remote grgit


    【解决方案1】:

    我可以这样做

    import org.ajoberstar.grgit.Grgit
    
    Grgit git = new Grgit()
    def gitRoot = project.hasProperty('git.root') ? project.property('git.root') : project.rootProject.projectDir
    git = Grgit.open(dir: gitRoot)
    System.out.println("git.remote.list().url -->"+git.remote.list().url)
    

    【讨论】:

      猜你喜欢
      • 2014-03-18
      • 1970-01-01
      • 2020-09-26
      • 1970-01-01
      • 2020-01-05
      • 2017-03-12
      • 1970-01-01
      • 2016-12-19
      • 1970-01-01
      相关资源
      最近更新 更多