Why am I seeing an 'unknown switch' error when attempting to push a merge request command in Gitlab version 14.95?

Viewed 37

I am fairly new to the world of Gitlab and am trying to get my head around this Gitlab CI/CD pipeline issue I'm experiencing. I am adjusting a job to run a script in a intermediary branch and then merge this newly created branch into the master.

I am experiencing different issues when trying this but my biggest concern are the 'Unknown switch' error messages I am receiving.

When running:

git push --push-option= merge_request.create --push-option= merge_request.target=master --push-option= merge_request.title="Process Update" --push-option= merge_request.description="Adding changes to master." --push-option= merge_request.merge_when_pipeline_succeeds --push-option= merge_request.assign="r.i"

or the equivalent using:

git push -o merge_request.create -o merge_request.target=master -o merge_request.title="Process Update" -o merge_request.description="Adding changes to master." -o merge_request.merge_when_pipeline_succeeds -o merge_request.assign="r.i"

The message I am met with:

error: unknown switch error: unknown switch `o'
usage: git push [<options>] [<repository> [<refspec>...]]
    -v, --verbose         be more verbose
    -q, --quiet           be more quiet
    --repo <repository>   repository
    --all                 push all refs
    --mirror              mirror all refs
    --delete              delete refs
    --tags                push tags (can't be used with --all or --mirror)
    -n, --dry-run         dry run
    --porcelain           machine-readable output
    -f, --force           force updates
    --recurse-submodules[=<check>]
                          control recursive pushing of submodules
    --thin                use thin pack
    --receive-pack <receive-pack>
                          receive pack program
    --exec <receive-pack>
                          receive pack program
    -u, --set-upstream    set upstream for git pull/status
    --progress            force progress reporting
    --prune               prune locally removed refs
    --no-verify           bypass pre-push hook
    --follow-tags         push missing but relevant tags

What am I missing? A missing module perhaps?

1 Answers

The --push-option (aka -o option) to git push was new in Git version 2.10. If your Git client predates this version, you must upgrade before you can send such options.

You probably want to upgrade to 2.18 or later so that you can configure push.pushOption; this was new in Git 2.18.

Related