git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* About the usage of core.gitproxy.
@ 2021-06-21 21:58 Hongyi Zhao
  2021-06-21 23:33 ` brian m. carlson
  0 siblings, 1 reply; 2+ messages in thread
From: Hongyi Zhao @ 2021-06-21 21:58 UTC (permalink / raw)
  To: Git List

On Ubuntu 20.04, I noticed the following document for `core.gitProxy':

$ man git-config |egrep -A13 -i '^[ ]*core.gitproxy'
       core.gitProxy
           A "proxy command" to execute (as command host port) instead
of establishing direct connection to
           the remote server when using the Git protocol for fetching.
If the variable value is in the
           "COMMAND for DOMAIN" format, the command is applied only on
hostnames ending with the specified
           domain string. This variable may be set multiple times and
is matched in the given order; the
           first match wins.

           Can be overridden by the GIT_PROXY_COMMAND environment
variable (which always applies
           universally, without the special "for" handling).

           The special string none can be used as the proxy command to
specify that no proxy be used for a
           given domain pattern. This is useful for excluding servers
inside a firewall from proxy use,
           while defaulting to a common proxy for external domains.

For my case, I've a local socks5 proxy running on "127.0.0.1:18888",
how should I set the above option so that the following command can
pick up this proxy:

$ git clone git@github.com:torvalds/linux.git

Regards
-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
NO. 552 North Gangtie Road, Xingtai, China

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: About the usage of core.gitproxy.
  2021-06-21 21:58 About the usage of core.gitproxy Hongyi Zhao
@ 2021-06-21 23:33 ` brian m. carlson
  0 siblings, 0 replies; 2+ messages in thread
From: brian m. carlson @ 2021-06-21 23:33 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: Git List

[-- Attachment #1: Type: text/plain, Size: 2298 bytes --]

On 2021-06-21 at 21:58:29, Hongyi Zhao wrote:
> On Ubuntu 20.04, I noticed the following document for `core.gitProxy':
> 
> $ man git-config |egrep -A13 -i '^[ ]*core.gitproxy'
>        core.gitProxy
>            A "proxy command" to execute (as command host port) instead
> of establishing direct connection to
>            the remote server when using the Git protocol for fetching.
> If the variable value is in the
>            "COMMAND for DOMAIN" format, the command is applied only on
> hostnames ending with the specified
>            domain string. This variable may be set multiple times and
> is matched in the given order; the
>            first match wins.
> 
>            Can be overridden by the GIT_PROXY_COMMAND environment
> variable (which always applies
>            universally, without the special "for" handling).
> 
>            The special string none can be used as the proxy command to
> specify that no proxy be used for a
>            given domain pattern. This is useful for excluding servers
> inside a firewall from proxy use,
>            while defaulting to a common proxy for external domains.

This configuration option is for the plain, unencrypted Git protocol
usually served on port 9418.  Almost nobody uses that these days,
though, since it is unencrypted.  This configuration option doesn't have
any effect on HTTPS or SSH operations.

> For my case, I've a local socks5 proxy running on "127.0.0.1:18888",
> how should I set the above option so that the following command can
> pick up this proxy:
> 
> $ git clone git@github.com:torvalds/linux.git

In this case, you need SSH to tunnel through a SOCKS proxy.  According
to [0], you can do this with the following data in your ~/.ssh/config:

  Host github.com
    ProxyCommand /usr/bin/nc -X 5 -x 127.0.0.1:7777 %h %p

If you want to do this as a one-off, you can also do this:

  GIT_SSH_COMMAND='ssh -oProxyCommand="/usr/bin/nc -X 5 -x 127.0.0.1:7777 %h %p"' \
    git clone git@github.com:torvalds/linux.git

Note that that requires a POSIX shell; I don't think it will work under
CMD or PowerShell.

[0] https://superuser.com/questions/454210/how-can-i-use-ssh-with-a-socks-5-proxy
-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-21 23:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-21 21:58 About the usage of core.gitproxy Hongyi Zhao
2021-06-21 23:33 ` brian m. carlson

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).