使用 LFS 从本地存储库进行 Git 克隆

Art*_*out 2 git clone git-lfs

我有一个本地 git 存储库,启用了 LFS。

我经常需要将其克隆到同一驱动器上的其他位置。虽然复制粘贴存储库可以完全满足我的要求,但我在执行此操作时遇到了一些问题git

cd C:\wrkfldr\SUBDIR
git clone "C:\wrkfldr\LOCAL_REPO\.git"
Run Code Online (Sandbox Code Playgroud)

退货

Cloning into 'LOCAL_REPO'...
done.
Downloading BIG_LFS_FILE.xlsm (6.4 MB)
Error downloading object: BIG_LFS_FILE.xlsm (01d6d9b): Smudge error: Error downloading BIG_LFS_FILE.xlsm (01d6d9b68a17724fbd7e5aad72b643621edf1ac9ccd34f3ea0874a870af87e4c): batch request: ssh: Could not resolve hostname c: Name or service not known: exit status 255

Errors logged to C:\Users\LOCAL_REPO\.git\lfs\logs\20191203T095345.1265547.log
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: BIG_LFS_FILE.xlsm: smudge filter lfs failed
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'
Run Code Online (Sandbox Code Playgroud)

看起来 LFS 想要下载该文件,将驱动器盘符视为C协议,而一切都是本地的。

我在Windows 10下。

有人遇到过这种情况吗?

fun*_*man 6

对于 Windows/Linux,您必须使用file:///前缀:

git clone file:///C:/wrkfldr/LOCAL_REPO/.git
Run Code Online (Sandbox Code Playgroud)

查看这个有趣的答案以了解详细信息:GIT clone repo across local file system in windows

  • 我认为这甚至不是特定于 Windows 的;在 Linux 下将 `file://` 添加到远程 URL 也对我有帮助。 (3认同)