有办法解决吗?
在远程名称前添加单词前缀safe
$ git remote rename {,safe}-myremotename
然后您可以再次使用它
$ git pull safe-myremotename
Successfully rebased and updated refs/heads/develop
正如您的问题所示,由于远程名称位于文件系统中并且也容易被注入,因此请考虑以下事项:
-
仅使用来自3.282 可移植文件名字符集
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
a b c d e f g h i j k l m n o p q r s t u v w x y z
0 1 2 3 4 5 6 7 8 9 . _ -
-
不要使用破折号-
作为第一个字符。 (ref)
-
请勿使用任何数字0-9
和字母a-f
/A-F
在远程名称内only(如果名称超过三个字符)。否则远程名称可能会被拒绝git(1)
在你的存储库的未来。 (ref)
还有更多一般性的内容:
- 考虑不要以数字开头名称
0-9
.
- 考虑不开始nor此处以标点符号结尾名称
.
, _
or -
.
- 考虑只使用一种情况,要么较低
a-z
or upper A-Z
.
- 考虑使远程名称尽可能长,同时尽可能短,不短于三个字母。八个字符通常是一个很好的最大值。
感谢您的提问。正是如你所写git-pull(1)
允许在之后指定远程名称--
而那在git-fetch(1)
通过它调用,远程名称将逐字传递到参数列表中。
它看起来并不像普通的注入就能获得整个面包店的所有权。唯一可以注入的东西git-fetch(1)
is a single参数由配置的remote.<name>
.
例如。有一个名为--all
我们可以发送git-pull(1)
(并且,通过),git-fetch(1)
进入子递归。这很有趣,但也有垃圾邮件tty
Example
遥控器名称:--all
的进程树git pull -- --all
(限6行):
121540 Ss+ 00:00:00 -/bin/sh
122011 T 00:00:00 \_ git pull -- --all
122012 T 00:00:00 \_ /usr/lib/git-core/git fetch --update-head-ok --all
122023 T 00:00:00 \_ /usr/lib/git-core/git fetch --append --no-auto-gc --no-write-commit-graph --update-head-ok --all
122034 T 00:00:00 \_ /usr/lib/git-core/git fetch --append --no-auto-gc --no-write-commit-graph --update-head-ok --all
122045 T 00:00:00 \_ /usr/lib/git-core/git fetch --append --no-auto-gc --no-write-commit-graph --update-head-ok --all
Does git-fetch(1)
已经在这里欺骗自己了吗?有点像,但前提是--jobs=1
. With --jobs=2
或高于2
, git-fetch(2)
是否处理该选项more按顺序进行,而不是一遍又一遍。但前提是至少有两个遥控器。
121540 Ss+ 00:00:00 -/bin/sh
127528 T 00:00:00 \_ git fetch --all
127539 T 00:00:00 \_ /usr/lib/git-core/git fetch --append --no-auto-gc --no-write-commit-graph --all
127550 T 00:00:00 \_ /usr/lib/git-core/git fetch --append --no-auto-gc --no-write-commit-graph --all
127561 T 00:00:00 \_ /usr/lib/git-core/git fetch --append --no-auto-gc --no-write-commit-graph --all
127572 T 00:00:00 \_ /usr/lib/git-core/git fetch --append --no-auto-gc --no-write-commit-graph --all
127583 T 00:00:00 \_ /usr/lib/git-core/git fetch --append --no-auto-gc --no-write-commit-graph --all
127594 T 00:00:00 \_ /usr/lib/git-core/git fetch --append --no-auto-gc --no-write-commit-graph --all
127605 T 00:00:00 \_ /usr/lib/git-core/git fetch --append --no-auto-gc --no-write-commit-graph --all
127616 T 00:00:00 \_ /usr/lib/git-core/git fetch --append --no-auto-gc --no-write-commit-graph --all
嗯,看起来像。git-fetch --all
没有健全性检查来检测它是否可以重入相同的远程名称,也似乎没有一个带有自己的参数的选项来表示远程(通过名称或 URL),这可以防止这种情况发生。
(git版本2.25.1)