Reputation: 533
I'm setting up CI for a C# project hosted on GitHub in a private repo.
Git is installed on master CentOS machine, MSBuild on slave windows.
I've created account on GitHub, and added it to my private repo.
When I'm setting up source control on Jenkins, I've entered URL (as https://github.com/.../repo.git
) and entered credentials with the new account.
Jenkins reports:
Failed to connect to repository : Command "git config --local credential.helper store --file=/tmp/git2956041026506359040.credentials" returned status code 129:
stdout:
stderr: error: unknown option `local'
usage: git config [options]
Config file location
--global use global config file
--system use system config file
-f, --file <FILE> use given config file
Action
--get get value: name [value-regex]
--get-all get all values: key [value-regex]
--get-regexp get values for regexp: name-regex [value-regex]
--replace-all replace all matching variables: name value [value_regex]
--add adds a new variable: name value
--unset removes a variable: name [value-regex]
--unset-all removes all matches: name [value-regex]
--rename-section rename section: old-name new-name
--remove-section remove a section: name
-l, --list list all
-e, --edit opens an editor
--get-color <slot> find the color configured: [default]
--get-colorbool <slot>
find the color setting: [stdout-is-tty]
Type
--bool value is "true" or "false"
--int value is decimal number
--bool-or-int value is --bool or --int
--path value is a path (file or directory name)
Other
-z, --null terminate values with NUL byte
If I log into master
and try the same command on root console I get the same error, --local
is not an option for git config
.
Upvotes: 12
Views: 18565
Reputation: 1324557
Now (2017), not only --local
is a valid option for git config
(since several years ago), its error message will be more precise.
See commit 3d7dd2d (21 May 2017) by Ramsay Jones (``).
See commit 25cd291, commit 588a538, commit d819374 (13 May 2017) by Jeff King (peff
).
(Merged by Junio C Hamano -- gitster
-- in commit 220c6a7, 29 May 2017)
config
: complain about--local
outside of a git repo
The "
--local
" option instructsgit-config
to read or modify the repository-level config. This doesn't make any sense if you're not actually in a repository.
Older versions of Git would blindly try to read or write "
.git/config
".
For reading, this would result in a quiet failure, since there was no config to read (and thus no matching config value).
Writing would generally fail noisily, since ".git
" was unlikely to exist.
But since b1ef400 (setup_git_env
: avoid blind fall-back to ".git
", 2016-10-20, Git 2.13), we catch this in the call togit_pathdup()
and die with an assertion.
Dying is the right thing to do, but we should catch the problem early and give a more human-friendly error message.
Before:
vonc@xxC:\Users\vonc\prog\xxx
> git config --local -l
fatal: BUG: setup_git_env called without repository
After (Git 2.14, Q3 2017)
vonc@xxC:\Users\vonc\prog\xxx
> git config --local -l
fatal: BUG: --local can only be used inside a git repository
And this applies to git config --worktree
too, with Git 2.29 (Q4 2020)
See commit 378fe5f from Matheus Tavares (matheustavares
)
(Merged by Junio C Hamano -- gitster
-- in commit 80cacae, 19 Sep 2020)
config
: complain about--worktree
outside of a git repoRunning
git config --worktree
outside of a git repository hits a BUG() when trying to enumerate the worktrees.
Let's catch this error earlier anddie()
with a friendlier message.
Instead of just --local can only be used inside a git repository
, you will now see:
--worktree can only be used inside a git repository
Upvotes: 0
Reputation: 1
It seems that jekins uses the default git under /usr/bin
. Check your /usr/bin/git
and confirm that it has the --local option.
Upvotes: -1
Reputation: 533
The problem was that Git was outdated, and version that comes with CentOS didn't support the --local option for git config.
Updating git to version 1.7.12 solved the issue.
Upvotes: 16