create pipeline: no import path for an existing Git-backed pipeline file
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- git, github, go
- Domain
- api, cli, developer-experience
Research direction
Start with the create pipeline mapping in pkg/spec/pipeline.spec.yaml around lines 483–511 and compare it with existing command qualifiers and import API patterns. Add an import entry point for an existing Git-backed file, handle the Git-backed flags without requiring -f, and verify that the command registers the existing path rather than attempting to create it.
Written by the indexing model from the issue text.
Description
Summary
There is no way to register an existing Git-backed pipeline file with the CLI. create pipeline --connector/--repo/--file-path maps to the create endpoint, which authors the YAML file in the repo, so it fails whenever the file is already committed — which is the normal Git-experience workflow (commit .harness/pipeline.yaml, then point Harness at it).
Harness has a separate import API for exactly this, and the Harness MCP server exposes it (execute action import, "Fetches the pipeline YAML from the specified repo/branch/path and creates a Harness pipeline record for it"). The CLI has no equivalent — grep -n "import" pkg/spec/pipeline.spec.yaml returns nothing on main.
Related: #211 — together these mean a Git-backed pipeline cannot be set up through the CLI alone.
Version
harness version 3.6.2 (2026-09-01T01:13:47Z)
Also verified against pkg/spec/pipeline.spec.yaml on main (v3.7.1) — unchanged.
Reproduction
With .harness/pipeline.yaml already committed on branch harness-ci-setup:
$ harness create pipeline MyPipeline \
--connector account.GitHub_Connector \
--repo my-repo \
--branch harness-ci-setup \
--file-path .harness/pipeline.yaml \
--project MyProject
required flag(s) "file" not set
Adding -f (see note below), the real failure appears:
$ harness create pipeline MyPipeline -f .harness/pipeline.yaml \
--connector account.GitHub_Connector \
--repo my-repo \
--branch harness-ci-setup \
--file-path .harness/pipeline.yaml \
--project MyProject
API error 400: Please check if there's already a file [.harness/pipeline.yaml] in
Github repository [my-repo] for the given filepath and branch [harness-ci-setup].
- Check whether the branch [harness-ci-setup] has some protection rules that may
prohibit creation of new file.
Expected: the pipeline is registered against the existing file.
Actual: 400, because the endpoint tries to create a file that already exists.
Root cause
pkg/spec/pipeline.spec.yaml (L483–511) points create pipeline at the create endpoint:
endpoint:
method: POST
path: /pipeline/api/pipelines/v2
query_params:
storeType: 'flags.repo != "" ? "REMOTE" : ""'
connectorRef: flags.connector
repoName: flags.repo
branch: flags.branch
filePath: flags["file-path"]
That path creates the remote file. The import endpoint is never wired up, and no pipeline:import qualifier exists in the spec.
Suggested fix
Add an import command mapping to the pipeline import API, e.g.:
harness create pipeline:import <id> --connector <ref> --repo <repo> \
--branch <branch> --file-path <path> [--force]
It takes no -f (the YAML is fetched from Git), and would want --name/--description for the created record, plus a force flag for re-import over an existing pipeline.
Secondary note: -f is required even in Git-backed mode
The help text reads as an either/or:
Create a pipeline: inline from YAML (-f file.yaml) or Git-backed (--connector, --repo, --file-path)
but file_body: required in the spec means -f is mandatory in both modes, and the first command above fails with required flag(s) "file" not set. In Git-backed mode the file content is also redundant with --file-path. Either make -f conditional, or reword the help to say it's always required.
Workaround
Use the Harness MCP server's import action, or the UI's "Import From Git".
- Dominant language
- Go
- Stars
- 22
- Forks
- 12
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 37
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from harness/cli
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
harness/cli#219 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
beta
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
linonetwo/cpa-session-archive#25 ·
Maintainers usually reply within 1 day
-
area/testing kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
agent-butler-finding bug
Difficulty 1/5 Under an hour Newbie friendliness 94/100
jordansmall/spindrift#4367 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day