Skip to content

unknown switch `B'

I installed this runner in CentOS 6.6, which has git 1.7.1, and got an unknown switch `B' error during build:

Starting build...
Using Shell executor...
Running on qcs19...
Clonning repository...
Initialized empty Git repository in /home/gitlab_ci_multi_runner/tmp/builds/runner-f76f2c53-project-1-concurrent-0/.git/
Checkouting 0be483a2 as master...
error: unknown switch `B'
usage: git checkout [options] <branch>
   or: git checkout [options] [<branch>] -- <file>...

    -q, --quiet           be quiet
    -b <new branch>       branch
    -l                    log for new branch
    -t, --track           track
    -2, --ours            stage
    -3, --theirs          stage
    -f, --force           force
    -m, --merge           merge
    --conflict <style>    conflict style (merge or diff3)
    -p, --patch           select hunks interactively


Build failed with exit status 129

Apparently git checkout -B ... is being used, which became available in git 1.7.3 (compare with 1.7.2).

So either indicate that it needs git 1.7.3+ in the docs, or stop using the -B switch. Note that gitlab-ci-runner doesn't use -B. (see https://github.com/gitlabhq/gitlab-ci-runner/blob/master/lib/build.rb)