# [PATCH] docs: indicate clearly that http.extraheader is not for creds

5 messages from 2026-11-21 to 2026-11-24. Participants: brian m. carlson, Junio C Hamano.
Thread: https://gitlist.dev/t/66910

## brian m. carlson, 2026-11-21 22:27

Subject: [PATCH] docs: indicate clearly that http.extraheader is not for creds
Message-ID: <20261121222723.23714-1-sandals@crustytoothpaste.net>
URL: https://gitlist.dev/e/20261121222723.23714-1-sandals%40crustytoothpaste.net

```
People frequently use http.extraheader for credentials, but it is not
intended for that and is easy to misuse.  People using it for
credentials often do not use the URL-qualified option, exposing their
credentials to every server Git connects to, or they specify it on the
command line or in the config file, potentially exposing it to other
users or to anyone who accesses the repo, respectively.

It's also known that using http.extraheader for the Authorization header
breaks some uses of Git LFS, where some parts of the protocol can
include their own Authorization header.  This is because that tool does
as Git does and always adds the header, leaving two Authorization
headers which breaks authentication.  However, using a credential helper
works fine, since Git LFS only calls the credential helper if it doesn't
have credentials.

Indicate clearly that http.extraheader should not be used for
credentials now that we have more robust credential helper support.
Remove text that suggests it might have sensitive information in it,
since it should not.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 Documentation/config/http.adoc | 8 ++++++++
 Documentation/git.adoc         | 7 +++----
 Documentation/gitfaq.adoc      | 3 ++-
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/Documentation/config/http.adoc b/Documentation/config/http.adoc
index 792a71b413..a8bd957585 100644
--- a/Documentation/config/http.adoc
+++ b/Documentation/config/http.adoc
@@ -111,6 +111,14 @@ http.extraHeader::
 	more than one such entry exists, all of them are added as extra
 	headers.  To allow overriding the settings inherited from the system
 	config, an empty value will reset the extra headers to the empty list.
++
+Note that this option should not be to pass credentials and using it for that
+purpose may cause security issues.  Using this option for the Authorization
+header can also break some external tools.
++
+A credential helper is almost always more secure and does not impact external
+tools negatively; note that modern credential helpers can implement any
+reasonable method of authentication, including Bearer.
 
 http.cookieFile::
 	The pathname of a file containing previously stored cookie lines,
diff --git a/Documentation/git.adoc b/Documentation/git.adoc
index 1aa0608bae..d2f56e2f91 100644
--- a/Documentation/git.adoc
+++ b/Documentation/git.adoc
@@ -104,10 +104,9 @@ where other processes might be able to read your command line
 (e.g. `/proc/self/environ`). That behavior is the default on
 Linux, but may not be on your system.
 +
-Note that this might add security for variables such as
-`http.extraHeader` where the sensitive information is part of
-the value, but not e.g. `url.<base>.insteadOf` where the
-sensitive information can be part of the key.
+Note that this might add security for variables where the sensitive
+information is part of the value, but not e.g. `url.<base>.insteadOf`
+where the sensitive information can be part of the key.
 
 --exec-path[=<path>]::
 	Path to wherever your core Git programs are installed.
diff --git a/Documentation/gitfaq.adoc b/Documentation/gitfaq.adoc
index b26e4e3a09..5bc33f7e26 100644
--- a/Documentation/gitfaq.adoc
+++ b/Documentation/gitfaq.adoc
@@ -120,7 +120,8 @@ them for a certain period of time.
 You can also just enter your password when prompted.  While it is possible to
 place the password (which must be percent-encoded) in the URL, this is not
 particularly secure and can lead to accidental exposure of credentials, so it is
-not recommended.
+not recommended.  For similar reasons, we don't recommend using the
+`http.extraheader` option for credentials, either.
 
 [[http-credentials-environment]]
 How do I read a password or token from an environment variable?::


```

## Junio C Hamano, 2026-11-22 01:12

Subject: Re: [PATCH] docs: indicate clearly that http.extraheader is not for creds
Message-ID: <xmqqzev1k6tj.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqzev1k6tj.fsf%40gitster.g
In-Reply-To: <20261121222723.23714-1-sandals@crustytoothpaste.net>

```
"brian m. carlson" <sandals@crustytoothpaste.net> writes:

> @@ -111,6 +111,14 @@ http.extraHeader::
>  	more than one such entry exists, all of them are added as extra
>  	headers.  To allow overriding the settings inherited from the system
>  	config, an empty value will reset the extra headers to the empty list.
> ++
> +Note that this option should not be to pass credentials and using it for that

"used" is missing in "should not be used to pass ..."?

> +purpose may cause security issues.  Using this option for the Authorization


```

## brian m. carlson, 2026-11-23 01:17

Subject: [PATCH v2] docs: indicate clearly that http.extraheader is not for creds
Message-ID: <20261123011744.723147-1-sandals@crustytoothpaste.net>
URL: https://gitlist.dev/e/20261123011744.723147-1-sandals%40crustytoothpaste.net
In-Reply-To: <20261121222723.23714-1-sandals@crustytoothpaste.net>

```
People frequently use http.extraheader for credentials, but it is not
intended for that and is easy to misuse.  People using it for
credentials often do not use the URL-qualified option, exposing their
credentials to every server Git connects to, or they specify it on the
command line or in the config file, potentially exposing it to other
users or to anyone who accesses the repo, respectively.

It's also known that using http.extraheader for the Authorization header
breaks some uses of Git LFS, where some parts of the protocol can
include their own Authorization header.  This is because that tool does
as Git does and always adds the header, leaving two Authorization
headers which breaks authentication.  However, using a credential helper
works fine, since Git LFS only calls the credential helper if it doesn't
have credentials.

Indicate clearly that http.extraheader should not be used for
credentials now that we have more robust credential helper support.
Remove text that suggests it might have sensitive information in it,
since it should not.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
Changes since v1:
* Include missing word.

 Documentation/config/http.adoc | 8 ++++++++
 Documentation/git.adoc         | 7 +++----
 Documentation/gitfaq.adoc      | 3 ++-
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/Documentation/config/http.adoc b/Documentation/config/http.adoc
index 792a71b413..d61180c909 100644
--- a/Documentation/config/http.adoc
+++ b/Documentation/config/http.adoc
@@ -111,6 +111,14 @@ http.extraHeader::
 	more than one such entry exists, all of them are added as extra
 	headers.  To allow overriding the settings inherited from the system
 	config, an empty value will reset the extra headers to the empty list.
++
+Note that this option should not be used to pass credentials and using it for
+that purpose may cause security issues.  Using this option for the
+Authorization header can also break some external tools.
++
+A credential helper is almost always more secure and does not impact external
+tools negatively; note that modern credential helpers can implement any
+reasonable method of authentication, including Bearer.
 
 http.cookieFile::
 	The pathname of a file containing previously stored cookie lines,
diff --git a/Documentation/git.adoc b/Documentation/git.adoc
index 1aa0608bae..d2f56e2f91 100644
--- a/Documentation/git.adoc
+++ b/Documentation/git.adoc
@@ -104,10 +104,9 @@ where other processes might be able to read your command line
 (e.g. `/proc/self/environ`). That behavior is the default on
 Linux, but may not be on your system.
 +
-Note that this might add security for variables such as
-`http.extraHeader` where the sensitive information is part of
-the value, but not e.g. `url.<base>.insteadOf` where the
-sensitive information can be part of the key.
+Note that this might add security for variables where the sensitive
+information is part of the value, but not e.g. `url.<base>.insteadOf`
+where the sensitive information can be part of the key.
 
 --exec-path[=<path>]::
 	Path to wherever your core Git programs are installed.
diff --git a/Documentation/gitfaq.adoc b/Documentation/gitfaq.adoc
index b26e4e3a09..5bc33f7e26 100644
--- a/Documentation/gitfaq.adoc
+++ b/Documentation/gitfaq.adoc
@@ -120,7 +120,8 @@ them for a certain period of time.
 You can also just enter your password when prompted.  While it is possible to
 place the password (which must be percent-encoded) in the URL, this is not
 particularly secure and can lead to accidental exposure of credentials, so it is
-not recommended.
+not recommended.  For similar reasons, we don't recommend using the
+`http.extraheader` option for credentials, either.
 
 [[http-credentials-environment]]
 How do I read a password or token from an environment variable?::


```

## Junio C Hamano, 2026-11-23 16:24

Subject: Re: [PATCH v2] docs: indicate clearly that http.extraheader is not for creds
Message-ID: <xmqq5wxnbjod.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqq5wxnbjod.fsf%40gitster.g
In-Reply-To: <20261123011744.723147-1-sandals@crustytoothpaste.net>

```
"brian m. carlson" <sandals@crustytoothpaste.net> writes:

> People frequently use http.extraheader for credentials, but it is not

Use camelCase `http.extraHeader` here, to match config/http.adoc and
what git.adoc used to say before you removed its mention.

> intended for that and is easy to misuse.  People using it for
> credentials often do not use the URL-qualified option, exposing their
> credentials to every server Git connects to, or they specify it on the
> command line or in the config file, potentially exposing it to other
> users or to anyone who accesses the repo, respectively.
>
> It's also known that using http.extraheader for the Authorization header

Ditto.

> breaks some uses of Git LFS, where some parts of the protocol can
> include their own Authorization header.  This is because that tool does
> as Git does and always adds the header, leaving two Authorization
> headers which breaks authentication.  However, using a credential helper
> works fine, since Git LFS only calls the credential helper if it doesn't
> have credentials.
>
> Indicate clearly that http.extraheader should not be used for

Ditto.

> credentials now that we have more robust credential helper support.
> Remove text that suggests it might have sensitive information in it,
> since it should not.
>
> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
> ---
> ...
> diff --git a/Documentation/config/http.adoc b/Documentation/config/http.adoc
> index 792a71b413..d61180c909 100644
> --- a/Documentation/config/http.adoc
> +++ b/Documentation/config/http.adoc
> @@ -111,6 +111,14 @@ http.extraHeader::
>  	more than one such entry exists, all of them are added as extra
>  	headers.  To allow overriding the settings inherited from the system
>  	config, an empty value will reset the extra headers to the empty list.
> ++
> +Note that this option should not be used to pass credentials and using it for
> +that purpose may cause security issues.  Using this option for the
> +Authorization header can also break some external tools.

Do we want the word in monospaced backquotes `Authorization`?

> ++
> +A credential helper is almost always more secure and does not impact external
> +tools negatively; note that modern credential helpers can implement any
> +reasonable method of authentication, including Bearer.

Do we want to linkgit:gitcredentials[7] somewhere, like the entry for
http.proxy does?

> diff --git a/Documentation/gitfaq.adoc b/Documentation/gitfaq.adoc
> index b26e4e3a09..5bc33f7e26 100644
> --- a/Documentation/gitfaq.adoc
> +++ b/Documentation/gitfaq.adoc
> @@ -120,7 +120,8 @@ them for a certain period of time.
>  You can also just enter your password when prompted.  While it is possible to
>  place the password (which must be percent-encoded) in the URL, this is not
>  particularly secure and can lead to accidental exposure of credentials, so it is
> -not recommended.
> +not recommended.  For similar reasons, we don't recommend using the
> +`http.extraheader` option for credentials, either.

Ditto on camelCase `http.extraHeader`.



```

## brian m. carlson, 2026-11-24 22:56

Subject: [PATCH v3] docs: indicate clearly that http.extraHeader is not for creds
Message-ID: <20261124225656.1615821-1-sandals@crustytoothpaste.net>
URL: https://gitlist.dev/e/20261124225656.1615821-1-sandals%40crustytoothpaste.net
In-Reply-To: <20261121222723.23714-1-sandals@crustytoothpaste.net>

```
People frequently use http.extraHeader for credentials, but it is not
intended for that and is easy to misuse.  People using it for
credentials often do not use the URL-qualified option, exposing their
credentials to every server Git connects to, or they specify it on the
command line or in the config file, potentially exposing it to other
users or to anyone who accesses the repo, respectively.

It's also known that using http.extraHeader for the Authorization header
breaks some uses of Git LFS, where some parts of the protocol can
include their own Authorization header.  This is because that tool does
as Git does and always adds the header, leaving two Authorization
headers which breaks authentication.  However, using a credential helper
works fine, since Git LFS only calls the credential helper if it doesn't
have credentials.

Indicate clearly that http.extraHeader should not be used for
credentials now that we have more robust credential helper support.
Remove text that suggests it might have sensitive information in it,
since it should not.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
Changes since v2:
* Use camelCase for `http.extraHeader`.
* Use backticks for `Authorization`
* Link to gitcredentials(7).

 Documentation/config/http.adoc | 9 +++++++++
 Documentation/git.adoc         | 7 +++----
 Documentation/gitfaq.adoc      | 3 ++-
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/Documentation/config/http.adoc b/Documentation/config/http.adoc
index 792a71b413..8f26eed6a4 100644
--- a/Documentation/config/http.adoc
+++ b/Documentation/config/http.adoc
@@ -111,6 +111,15 @@ http.extraHeader::
 	more than one such entry exists, all of them are added as extra
 	headers.  To allow overriding the settings inherited from the system
 	config, an empty value will reset the extra headers to the empty list.
++
+Note that this option should not be used to pass credentials and using it for
+that purpose may cause security issues.  Using this option for the
+`Authorization` header can also break some external tools.
++
+A credential helper is almost always more secure and does not impact external
+tools negatively; note that modern credential helpers can implement any
+reasonable method of authentication, including Bearer. See
+linkgit:gitcredentials[7] for more information.
 
 http.cookieFile::
 	The pathname of a file containing previously stored cookie lines,
diff --git a/Documentation/git.adoc b/Documentation/git.adoc
index 1aa0608bae..d2f56e2f91 100644
--- a/Documentation/git.adoc
+++ b/Documentation/git.adoc
@@ -104,10 +104,9 @@ where other processes might be able to read your command line
 (e.g. `/proc/self/environ`). That behavior is the default on
 Linux, but may not be on your system.
 +
-Note that this might add security for variables such as
-`http.extraHeader` where the sensitive information is part of
-the value, but not e.g. `url.<base>.insteadOf` where the
-sensitive information can be part of the key.
+Note that this might add security for variables where the sensitive
+information is part of the value, but not e.g. `url.<base>.insteadOf`
+where the sensitive information can be part of the key.
 
 --exec-path[=<path>]::
 	Path to wherever your core Git programs are installed.
diff --git a/Documentation/gitfaq.adoc b/Documentation/gitfaq.adoc
index b26e4e3a09..dce40e659b 100644
--- a/Documentation/gitfaq.adoc
+++ b/Documentation/gitfaq.adoc
@@ -120,7 +120,8 @@ them for a certain period of time.
 You can also just enter your password when prompted.  While it is possible to
 place the password (which must be percent-encoded) in the URL, this is not
 particularly secure and can lead to accidental exposure of credentials, so it is
-not recommended.
+not recommended.  For similar reasons, we don't recommend using the
+`http.extraHeader` option for credentials, either.
 
 [[http-credentials-environment]]
 How do I read a password or token from an environment variable?::


```
