Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
git ls remote和git ls remote origin之间的差异_Git - Fatal编程技术网

git ls remote和git ls remote origin之间的差异

git ls remote和git ls remote origin之间的差异,git,Git,运行git-ls-remote和git-ls-remote-origin有什么区别?此时会出现git ls remote输出原始存储库的每个分支和标记的SHA1 ID。由于原始回购默认标题为origin,因此这两个命令似乎产生相同的输出。这是对的吗?你是对的。因为您的遥控器被称为origin,所以这两个命令之间没有区别 要查看所有git remote,请运行git remote-v 另一方面,如果您的遥控器被调用为foobar,则git ls remote origin会给您带来以下错误: $

运行
git-ls-remote
git-ls-remote-origin
有什么区别?此时会出现
git ls remote
输出原始存储库的每个分支和标记的SHA1 ID。由于原始回购默认标题为origin,因此这两个命令似乎产生相同的输出。这是对的吗?

你是对的。因为您的遥控器被称为
origin
,所以这两个命令之间没有区别

要查看所有git remote,请运行
git remote-v

另一方面,如果您的遥控器被调用为
foobar
,则
git ls remote origin
会给您带来以下错误:

$ git ls-remote origin
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
虽然没有提到这一点,但此处的默认参数计算与以下参数相同:

未指定远程时,默认情况下将使用
源站
远程,除非为当前分支配置了上游分支


这意味着,如果您定义了多个遥控器(例如,
origin
second
),并且您在分支
B
上,且
branch.B.remote
设置为
second
,则不带任何参数运行
gitlsremote
,现在相当于运行
gitlsremotesecond
。如果您在一个更典型的分支上,将
branch.branch.remote
设置为
origin
或根本不设置,则运行
git ls remote
而不指定特定的远程相当于运行
git ls remote origin

,我认为可能会有所不同<代码>git ls远程源--头。dev
提供的输出与git ls remote--heads不同。开发人员。至少如果您没有本地分支
dev
。在我看来,
ls remote origin
似乎使用您的网络来检查远程,但是如果您使用
--heads
标志,则
ls remote
不会列出“dev”。