Repository navigation
config: make the suggested "set" command safe to paste - #2457
Draft
HaraldNordgren wants to merge 1 commit into
Draft
HaraldNordgren wants to merge 1 commit into
HaraldNordgren wants to merge 1 commit into
Conversation
HaraldNordgren
force-pushed
the
config-set-hint-quote
branch
from
October 19, 2026 16:19
3cb6448 to
61d36ab
Compare
HaraldNordgren
force-pushed
the
config-set-hint-quote
branch
from
October 19, 2026 16:34
61d36ab to
00f87f6
Compare
When "git config" is given "<key>=<value>" as a single argument and
the value contains spaces, the suggested command does not work when
pasted back into a shell:
$ git config status.comparebranches="@{upstream} @{push}"
error: missing value to set to the variable 'status.comparebranches=@{upstream} @{push}'
hint: did you mean "git config set status.comparebranches @{upstream} @{push}"?
The shell splits the value into two arguments and the command fails
with "wrong number of arguments".
Quote the value when it needs it, and put the command on a line of
its own the way other hints show commands, so it can be copied
without the surrounding quotes:
hint: did you mean:
hint:
hint: git config set status.comparebranches '@{upstream} @{push}'
Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
HaraldNordgren
force-pushed
the
config-set-hint-quote
branch
from
October 19, 2026 17:58
00f87f6 to
2aeb767
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
git config <key>=<value>is given a value with spaces, the suggested command fails when pasted back into a shell. Quote the value when it needs it and put the command on its own line, the way other hints show commands: