Git PullRequest作业失败。不能';找不到要生成的任何修订。验证此作业的存储库和分支配置

Git PullRequest作业失败。不能';找不到要生成的任何修订。验证此作业的存储库和分支配置,git,jenkins,pull-request,Git,Jenkins,Pull Request,昨天我的pullrequest作业失败,输出如下: 11:07:41 > git rev-parse origin/${sha1}^{commit} 11:07:41 > git rev-parse ${sha1}^{commit} 11:07:41 ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job. 我做了一次调查,发现

昨天我的pullrequest作业失败,输出如下:

11:07:41  > git rev-parse origin/${sha1}^{commit}
11:07:41  > git rev-parse ${sha1}^{commit}
11:07:41 ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
我做了一次调查,发现在${sha1}房产里什么都没有。当我将绝对路径粘贴到请求生成器(如pr/341/merge)而不是${sha1}时,构建工作正常。可能是什么

Git客户端插件 1.9.0

GithubAPI插件
1.44如上所述,如果要手动生成作业,请在作业设置中检查此生成是否已参数化,并添加名为
sha1
的字符串参数,默认值为
master
。启动构建时,请提供要构建的sha1参数commit id或refname(例如:origin/pr/9/head)。

我花了很长时间在这方面。上面的评论“如果我将此字段留空”非常有效。在SCM中:
1) 选择Git
2) 名称:
origin

3) Refspec:
+refs/pull/*:refs/remotes/origin/pr/*

4) 要构建的分支:留空

这解决了上述错误。

如果“分支说明符”设置不正确,有时会出现这种情况。 我更正了说明符,它对我有效

*/release/release4.5.0


经过大量的研究和突破。我收到了相同的错误,我发现如果使用不同的git路径,也会发生此错误。确保你有正确的路径。例如:
我用C:\Program Files\Git\Git bash.exe替换了C:\Program Files\Git\bin\Git.exe,解决了这个问题。

我通过使用“要构建的分支-分支说明符”中的
refs/heads/
语法修复了这个错误消息

例如,我将
refs/remotes/origin/master
作为修复作业的分支说明符,而不是
origin/master

(在我的情况下,我不确定是什么原因导致出现此错误消息,因为作业以前仅使用
origin/master
作为分支说明符工作正常。这可能是相关的更新或配置更改…)


请注意,您可以使用命令列出本地存储库中的引用,例如

git show-ref master
28f1f186807d1316bf1c59631d6d8825a5087e27 refs/heads/master
28f1f186807d1316bf1c59631d6d8825a5087e27 refs/remotes/origin/master
此外,“分支说明符”字段旁边的“?”帮助文档也支持此答案,作为指定分支说明符以确保预期分支明确无误的最安全选项:

Specify the branches if you'd like to track a specific branch in a repository. If left blank, all branches will be examined for changes and built.

The safest way is to use the refs/heads/<branchName> syntax. This way the expected branch is unambiguous.

Possible options:

<branchName>
Tracks/checks out the specified branch. If ambiguous the first result is taken, which is not necessarily the expected one. Better use refs/heads/<branchName>.
E.g. master, feature1,...

refs/heads/<branchName>
Tracks/checks out the specified branch.
E.g. refs/heads/master, refs/heads/feature1/master,...

<remoteRepoName>/<branchName>
Tracks/checks out the specified branch. If ambiguous the first result is taken, which is not necessarily the expected one.
Better use refs/heads/<branchName>.
E.g. origin/master

remotes/<remoteRepoName>/<branchName>
Tracks/checks out the specified branch.
E.g. remotes/origin/master

refs/remotes/<remoteRepoName>/<branchName>
Tracks/checks out the specified branch.
E.g. refs/remotes/origin/master

<tagName>
This does not work since the tag will not be recognized as tag.
Use refs/tags/<tagName> instead.
E.g. git-2.3.0

refs/tags/<tagName>
Tracks/checks out the specified tag.
E.g. refs/tags/git-2.3.0

<commitId>
Checks out the specified commit.
E.g. 5062ac843f2b947733e6a3b105977056821bd352, 5062ac84, ...

${ENV_VARIABLE}
It is also possible to use environment variables. In this case the variables are evaluated and the result is used as described above.
E.g. ${TREEISH}, refs/tags/${TAGNAME},...

<Wildcards>
The syntax is of the form: REPOSITORYNAME/BRANCH. In addition, BRANCH is recognized as a shorthand of */BRANCH, '*' is recognized as a wildcard, and '**' is recognized as wildcard that includes the separator '/'. Therefore, origin/branches* would match origin/branches-foo but not origin/branches/foo, while origin/branches** would match both origin/branches-foo and origin/branches/foo.

:<regular expression>
The syntax is of the form: :regexp. Regular expression syntax in branches to build will only build those branches whose names match the regular expression.
如果要跟踪存储库中的特定分支,请指定分支。如果留空,将检查所有分支的更改并构建它们。
最安全的方法是使用refs/heads/语法。这样,预期的分支是明确的。
可能的选择:
跟踪/签出指定的分支。如果不明确,则取第一个结果,但不一定是预期结果。最好使用refs/heads/。
例如:大师、特征1,。。。
参考文献/总目/
跟踪/签出指定的分支。
例如:参考文献/头/硕士,参考文献/头/特征1/硕士,。。。
/
跟踪/签出指定的分支。如果不明确,则取第一个结果,但不一定是预期结果。
最好使用refs/heads/。
例如,原产地/主产地
遥控器//
跟踪/签出指定的分支。
例如,遥控器/原点/主控器
参考/遥控器//
跟踪/签出指定的分支。
例如:参考/遥控器/原点/主
这不起作用,因为标记不会被识别为标记。
改用refs/tags/代替。
例如git-2.3.0
参考文献/标签/
跟踪/签出指定的标记。
例如,参考文献/标签/git-2.3.0
签出指定的提交。
例如,5062ac843f2b947733e6a3b105977056821bd352、5062ac84。。。
${ENV_变量}
也可以使用环境变量。在这种情况下,对变量进行评估,并如上所述使用结果。
例如${TREEISH},refs/tags/${TAGNAME},。。。
语法的形式为:REPOSITORYNAME/BRANCH。此外,BRANCH被识别为*/BRANCH的缩写,“*”被识别为通配符,“**”被识别为包含分隔符“/”的通配符。因此,原点/分支*将匹配原点/分支foo,但不匹配原点/分支/foo,而原点/分支**将匹配原点/分支foo和原点/分支/foo。
:
语法的形式为::regexp。要生成的分支中的正则表达式语法将只生成名称与正则表达式匹配的分支。

我遇到了同样的问题,花了4个小时才解决,但最终还是解决了

在我的例子中,错误是因为错误的Git exe。在Jenkins内部,在windows上设置Git exe路径时,在cmd文件夹下设置路径

在我的例子中,它是C:\ProgramFiles\Git\cmd\Git.exe


它解决了我的问题。

我也有同样的问题。在我的案例中,原因是我使用了一个github存储库,它是svn存储库的镜像(因为云不正确支持svn)。Jenkins中的默认值是
*/master
。解决方案()是使用
*/trunk
。另一个问题是URL中不应使用的“.git”。

每当我们没有指定要拉取的正确分支时,git都会查找存储库中的所有分支,并最终抛出一个错误:“找不到任何要构建的修订。请验证此作业的存储库和分支配置。”

我在git pull中遇到了同样的问题,我使用jenkins来指定配置


如果我们将其保留为空,它将从master branch获取文件,但如果出现错误或键入错误,它将查找所有分支并抛出错误,表示branch not found。

我最近遇到了相同的错误,并且由于我想让Jenkins签出我代码的特定分支,上述任何一项都不适用于我。分支名称设置为${branch},这是我在同一作业上创建的Jenkins参数

如果我用其他的树枝,效果很好。我花了很长时间调试,因为它在其他地方都能工作。我可以克隆回购协议,自己在本地签出该分支,而不会出现问题。但只有詹金斯似乎没有
Specify the branches if you'd like to track a specific branch in a repository. If left blank, all branches will be examined for changes and built.

The safest way is to use the refs/heads/<branchName> syntax. This way the expected branch is unambiguous.

Possible options:

<branchName>
Tracks/checks out the specified branch. If ambiguous the first result is taken, which is not necessarily the expected one. Better use refs/heads/<branchName>.
E.g. master, feature1,...

refs/heads/<branchName>
Tracks/checks out the specified branch.
E.g. refs/heads/master, refs/heads/feature1/master,...

<remoteRepoName>/<branchName>
Tracks/checks out the specified branch. If ambiguous the first result is taken, which is not necessarily the expected one.
Better use refs/heads/<branchName>.
E.g. origin/master

remotes/<remoteRepoName>/<branchName>
Tracks/checks out the specified branch.
E.g. remotes/origin/master

refs/remotes/<remoteRepoName>/<branchName>
Tracks/checks out the specified branch.
E.g. refs/remotes/origin/master

<tagName>
This does not work since the tag will not be recognized as tag.
Use refs/tags/<tagName> instead.
E.g. git-2.3.0

refs/tags/<tagName>
Tracks/checks out the specified tag.
E.g. refs/tags/git-2.3.0

<commitId>
Checks out the specified commit.
E.g. 5062ac843f2b947733e6a3b105977056821bd352, 5062ac84, ...

${ENV_VARIABLE}
It is also possible to use environment variables. In this case the variables are evaluated and the result is used as described above.
E.g. ${TREEISH}, refs/tags/${TAGNAME},...

<Wildcards>
The syntax is of the form: REPOSITORYNAME/BRANCH. In addition, BRANCH is recognized as a shorthand of */BRANCH, '*' is recognized as a wildcard, and '**' is recognized as wildcard that includes the separator '/'. Therefore, origin/branches* would match origin/branches-foo but not origin/branches/foo, while origin/branches** would match both origin/branches-foo and origin/branches/foo.

:<regular expression>
The syntax is of the form: :regexp. Regular expression syntax in branches to build will only build those branches whose names match the regular expression.
origin/feature/branch_name