← 返回命令列表

Linux command

git-remote-ext 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Clone via external command

git clone "ext::[command] [args]"

Use with custom transport

git remote add myremote "ext::[transport-cmd] %S [host]"

说明

git-remote-ext is a remote helper that allows arbitrary external commands to handle Git transport. The `ext::` URL scheme specifies a command to run for communication, enabling custom transport mechanisms like specific SSH commands or non-standard protocols. Template variables (such as `%s`, `%S`, `%G`) allow dynamic command construction based on the Git service being requested. This helper is typically not invoked directly but is used through `ext::` URLs in remote configurations.

参数

%s
Replaced with service name (e.g. `upload-pack`, `receive-pack`, `upload-archive`) without the `git-` prefix.
%S
Replaced with long service name (e.g. `git-upload-pack`) including the `git-` prefix.
%G
Placed as the first argument; suppresses the service-name argument so the remote command can accept extra positional arguments.
%V
Only valid as the second argument; injects the Git protocol version (e.g. `version=2`) as an environment setting.
%%
Literal percent sign.
--help
Display help information.

FAQ

What is the git-remote-ext command used for?

git-remote-ext is a remote helper that allows arbitrary external commands to handle Git transport. The `ext::` URL scheme specifies a command to run for communication, enabling custom transport mechanisms like specific SSH commands or non-standard protocols. Template variables (such as `%s`, `%S`, `%G`) allow dynamic command construction based on the Git service being requested. This helper is typically not invoked directly but is used through `ext::` URLs in remote configurations.

How do I run a basic git-remote-ext example?

Run `git clone "ext::[command] [args]"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does %s do in git-remote-ext?

Replaced with service name (e.g. `upload-pack`, `receive-pack`, `upload-archive`) without the `git-` prefix.