【问题标题】:how to clone ssh remote repository using jgit and apache ant task?如何使用 jgit 和 apache ant 任务克隆 ssh 远程存储库?
【发布时间】:2014-07-16 20:34:47
【问题描述】:

我有一个地址为ssh://user@host.com/git/repository/project.git 的远程存储库 和密码

而且我需要使用带有 ant 任务的 jgit 克隆它。不幸的是,我无法使用标准的 jgit git-clone ant 任务克隆它,因为我什至在能够输入密码之前就收到了身份验证错误。我尝试检查解决方案,但还没有运气。我应该怎么办?我应该以某种方式自定义该任务吗?

使用命令行 git 命令git clone ssh://user@host.com/git/repository/project.git 克隆该项目并在之后声明密码没有问题

【问题讨论】:

    标签: git ant ssh git-clone jgit


    【解决方案1】:

    显然JGit's clone task 不支持密码验证。如果您真的想使用密码进行身份验证(密码将在 build.xml 文件中结束),您必须编写自己的 ant 任务或增强 JGit 附带的任务。

    使用CloneCommand#setCredentialsProvider(),您可以指定一个CredentialsProvider,它可以将密码从Ant 任务传递给命令。

    【讨论】:

      猜你喜欢
      • 2017-12-24
      • 2010-12-14
      • 1970-01-01
      • 2013-07-14
      • 2019-10-03
      • 2017-08-07
      • 1970-01-01
      • 1970-01-01
      • 2013-05-11
      相关资源
      最近更新 更多