Skip to content

Commit 2c9a2ae

Browse files
peffgitster
authored andcommitted
docs/config: mention protocol implications of url.insteadOf
If a URL rewrite switches the protocol to something nonstandard (like "persistent-https" for "https"), the user may be bitten by the fact that the default protocol restrictions are different between the two. Let's drop a note in insteadOf that points the user in the right direction. It would be nice if we could make this work out of the box, but we can't without knowing the security implications of the user's rewrite. Only the documentation for a particular remote helper can advise one way or the other. Since we do include the persistent-https helper in contrib/ (and since it was the helper in the real-world case that inspired that patch), let's also drop a note there. Suggested-by: Elliott Cable <[email protected]> Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b06d364 commit 2c9a2ae

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Documentation/config.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3208,6 +3208,13 @@ url.<base>.insteadOf::
32083208
the best alternative for the particular user, even for a
32093209
never-before-seen repository on the site. When more than one
32103210
insteadOf strings match a given URL, the longest match is used.
3211+
+
3212+
Note that any protocol restrictions will be applied to the rewritten
3213+
URL. If the rewrite changes the URL to use a custom protocol or remote
3214+
helper, you may need to adjust the `protocol.*.allow` config to permit
3215+
the request. In particular, protocols you expect to use for submodules
3216+
must be set to `always` rather than the default of `user`. See the
3217+
description of `protocol.allow` above.
32113218

32123219
url.<base>.pushInsteadOf::
32133220
Any URL that starts with this value will not be pushed to;

contrib/persistent-https/README

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ to use persistent-https:
3535
[url "persistent-http"]
3636
insteadof = http
3737

38+
You may also want to allow the use of the persistent-https helper for
39+
submodule URLs (since any https URLs pointing to submodules will be
40+
rewritten, and Git's out-of-the-box defaults forbid submodules from
41+
using unknown remote helpers):
42+
43+
[protocol "persistent-https"]
44+
allow = always
45+
[protocol "persistent-http"]
46+
allow = always
47+
3848

3949
#####################################################################
4050
# BUILDING FROM SOURCE

0 commit comments

Comments
 (0)