【问题标题】:Git clone from local repo with LFS使用 LFS 从本地仓库克隆 Git
【发布时间】:2019-12-03 08:59:54
【问题描述】:

我有一个本地 git repo,启用了 LFS。

我经常需要将它克隆到同一驱动器上的其他位置。虽然复制粘贴 repo 完全符合我的要求,但我在使用 git 本身时遇到了一些问题:

cd C:\wrkfldr\SUBDIR
git clone "C:\wrkfldr\LOCAL_REPO\.git"

返回

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 :/'

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

我在 Windows 10 下。

有没有人遇到过这种情况?

【问题讨论】:

    标签: git clone git-lfs


    【解决方案1】:

    对于 Windows,您需要使用 file:/// 前缀:

    git clone file:///C:/wrkfldr/LOCAL_REPO/.git
    

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

    【讨论】:

    • 这确实成功地克隆了 repo(尽管我必须用斜杠替换所有反斜杠)。但并非所有 LFS 都被拉取。当我这样做时,只下载工作目录中的最后一个 LFS 文件,但所有以前的版本都不存在(.git 目录不包含它们)
    • 我的错,我想这在你给LFS pointer files的链接中解释了@
    • @ArthurAttout 随时提出任何问题。
    • 我认为这甚至不是特定于 Windows 的;将file:// 添加到远程 URL 对我在 Linux 下也有帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-27
    • 1970-01-01
    • 2015-06-12
    • 2014-02-26
    • 2015-08-11
    相关资源
    最近更新 更多