本地目录的浅克隆需要file://
如下所述:git clone:warning:在本地克隆中忽略--depth; 使用file://代替
但是如何使用相对路径呢?
例如:如果我myrepo
在当前目录中有一个repo ,那么我这样做:
git clone --depth 1 file://mymodule mymodule2
Run Code Online (Sandbox Code Playgroud)
然后它失败了:
Cloning into 'mymodule2'...
fatal: No path specified. See 'man git-pull' for valid url syntax
Run Code Online (Sandbox Code Playgroud)
如果我尝试:
git clone --depth 1 file://./mymodule mymodule2
Run Code Online (Sandbox Code Playgroud)
它失败了:
Cloning into 'mymodule2'...
fatal: '/./mymodule' 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.
Run Code Online (Sandbox Code Playgroud)
我能找到的唯一解决方法是将其转换为绝对路径,从以下开始/
:
git clone --depth 1 …
Run Code Online (Sandbox Code Playgroud) git ×1