Skip to content

Commit 1260f81

Browse files
committed
Merge branch 'jk/credential-sample-update'
The samples in the credential documentation has been updated to make it clear that we depict what would appear in the .git/config file, by adding appropriate quotes as needed.. * jk/credential-sample-update: gitcredentials(7): make shell-snippet example more realistic gitcredentials(7): clarify quoting of helper examples
2 parents dc4c393 + 177681a commit 1260f81

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

Documentation/gitcredentials.txt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,20 +216,26 @@ Here are some example specifications:
216216

217217
----------------------------------------------------
218218
# run "git credential-foo"
219-
foo
219+
[credential]
220+
helper = foo
220221

221222
# same as above, but pass an argument to the helper
222-
foo --bar=baz
223+
[credential]
224+
helper = "foo --bar=baz"
223225

224226
# the arguments are parsed by the shell, so use shell
225227
# quoting if necessary
226-
foo --bar="whitespace arg"
228+
[credential]
229+
helper = "foo --bar='whitespace arg'"
227230

228231
# you can also use an absolute path, which will not use the git wrapper
229-
/path/to/my/helper --with-arguments
232+
[credential]
233+
helper = "/path/to/my/helper --with-arguments"
230234

231235
# or you can specify your own shell snippet
232-
!f() { echo "password=`cat $HOME/.secret`"; }; f
236+
[credential "https://example.com"]
237+
username = your_user
238+
helper = "!f() { test \"$1\" = get && echo \"password=$(cat $HOME/.secret)\"; }; f"
233239
----------------------------------------------------
234240

235241
Generally speaking, rule (3) above is the simplest for users to specify.

0 commit comments

Comments
 (0)