在 2023-10-25星期三的 10:14 +0800,xiao sheng wen(肖盛文)写道: > 大家好! > > 使用 debcheckout -a 可以直接设置好仓库提交权限的 URL。 > > man debcheckout 看到有个 DEBCHECKOUT_AUTH_URLS 变量可以增加自定义的 git > 仓库设置: > > DEBCHECKOUT_AUTH_URLS > This variable should be a space separated list of Perl regular > expressions and replacement texts, which must come in pairs: > REGEXP > TEXT REGEXP TEXT ... and so on. Each pair denotes a substitution > which is applied to repository URLs if other built-in means of > building URLs for authenticated mode (see -a) have failed. > > References to matching substrings in the replacement texts are > allowed as usual in Perl by the means of $1, $2, ... and so on. > > This setting is used to configure the "authenticated mode" > location > for repositories. The Debian repositories on > salsa.debian.org are > implicitly defined, as is github.com. > > Here is a sample snippet suitable for the configuration files: > > DEBCHECKOUT_AUTH_URLS=' > ^\w+://(svn\.example\.com)/(.*) svn+ssh://$1/srv/svn/$2 > ^\w+://(git\.example\.com)/(.*) git+ssh://$1/home/git/$2 > ' > > 想请教大家下, 该如何设置 码云 的这个正则表达式呢? > > 如: > > debcheckout -a atzlinux-update-patch > can't use authenticated mode on repository > 'https://gitee.com/atzlinux/atzlinux-update-patch.git' since it is not a > known repository (e.g. salsa.debian.org) > > 报错,希望能够设置为: > > g...@gitee.com:atzlinux/atzlinux-update-patch.git
自己要设置的话本质上和手册页里的示例没什么区别:REGEXP 和 TEXT 两部分,REGEXP 中将示例的 svn.example.com 替换成 gitee 的域名,TEXT 中搭好 ssh 克隆使用的字符串的骨架(也就是 username@domain:user/repo.git 这样)然后仍然是 $1 替换域名 $2 替换冒号之后的字符串,唯一注意一下 @ 符号要转义即可。 谢谢, Boyuan Yang
signature.asc
Description: This is a digitally signed message part