Jenkins git插件不允许存储库URL上的参数

时间:2014-07-01 23:06:26

标签: git jenkins

首先,我可以使用我的用户凭据访问我的git存储库。

但是如果我创建一个名为my repository的字符串参数并在存储库url上使用此参数($ {parameter}的值为ssh://git@myrepo/java/login.git),那么在构建过程中git插件在控制台日志上打印扩展值但我收到验证错误。或者git插件尝试在没有expand参数的情况下连接到url,或者忘记发送用户凭据。

Cloning repository ssh://git@myrepo/java/login.git
git init /var/lib/jenkins/jobs/teste/workspace
Fetching upstream changes from ssh://git@myrepo/java/login.git
git --version
git fetch --tags --progress ssh://git@myrepo/java/login.git +refs/heads/*:refs/remotes/origin/* --depth=1
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --tags --progress ssh://git@myrepo/java/login.git +refs/heads/*:refs/remotes/origin/* --depth=1" returned status code 128:
stdout: 
stderr: Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1325)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1186)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$200(CliGitAPIImpl.java:87)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:257)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:413)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:846)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:879)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1252)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:624)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:530)
    at hudson.model.Run.execute(Run.java:1732)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:234)
ERROR: null
Finished: FAILURE

是否可以使用参数来定义git存储库?

1 个答案:

答案 0 :(得分:0)

在参数中省略'ssh://',它应该可以很好地工作。