git pipeline fails with error: needs to match exactly one accessor! (when .gitlab_ci.yml calls a template from another repo)

git pipeline fails with error: needs to match exactly one accessor! (when .gitlab_ci.yml calls a template from another repo)

我正在尝试让我的 gitlab 管道从另一个存储库调用管道模板。管道失败并出现以下错误:

顺便说一句,如果删除对外部回购的引用,而是在本地调用回购时引用文件,则管道会成功)。 gitlab-ci-template.yml 文件同时存在于调用仓库和被调用仓库中。

错误:

Found errors in your .gitlab-ci.yml:
Include `{"file":"/gitlab_ci_template.yml"}` needs to match exactly one accessor!
You can also test your .gitlab-ci.yml in CI Lint

我的.gitlabci.yml

image:
  name: ubuntu:20.04
  entrypoint:
    - '/usr/bin/env'
    - 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'

include:
  - project: 'foocompany/sandbox/foo-sandbox/templates/pipelines/test_include_pipeline_source'
  - file: '/gitlab_ci_template.yml'

你在“文件”前多了一个“-”。该行不需要破折号。