Git 2.8 无法更新子模块
Git 2.8 fails to update submodules
我正在尝试 build gRPC 在 docker 图像中,但是在使用 git 版本 2.8 时更新子模块失败。特别是这个 Dockerfile:
FROM alpine:3.3
RUN apk update && apk add git
RUN git clone -b 'v1.17.1' --depth 1 https://github.com/grpc/grpc
RUN git --version
RUN cd grpc && git submodule update --init --depth 1
显示git version 2.8.6
并抛出以下错误
Cloning into '/grpc/third_party/abseil-cpp'...
error: no such remote ref cc4bed2d74f7c8717e31f9579214ab52a9c9c610
如果我切换到 alpine:3.8
,我会得到 git version 2.18.1
,并且构建成功。这是 git 早期版本中的错误吗?有解决方法吗?
备注:
- 我指定
--depth 1
因为我不需要提交历史记录。
- 我有一些不相关的约束,这使得我很难使用更新的版本。
正如您在“How to make shallow git submodules?”中看到的那样,自Git 2.8.
以来已经进行了多次进化
如果可用,请尝试只使用一个步骤:
git clone -b 'v1.17.1' --recurse-submodule --depth 1 https://github.com/grpc/grpc
我正在尝试 build gRPC 在 docker 图像中,但是在使用 git 版本 2.8 时更新子模块失败。特别是这个 Dockerfile:
FROM alpine:3.3
RUN apk update && apk add git
RUN git clone -b 'v1.17.1' --depth 1 https://github.com/grpc/grpc
RUN git --version
RUN cd grpc && git submodule update --init --depth 1
显示git version 2.8.6
并抛出以下错误
Cloning into '/grpc/third_party/abseil-cpp'...
error: no such remote ref cc4bed2d74f7c8717e31f9579214ab52a9c9c610
如果我切换到 alpine:3.8
,我会得到 git version 2.18.1
,并且构建成功。这是 git 早期版本中的错误吗?有解决方法吗?
备注:
- 我指定
--depth 1
因为我不需要提交历史记录。 - 我有一些不相关的约束,这使得我很难使用更新的版本。
正如您在“How to make shallow git submodules?”中看到的那样,自Git 2.8.
以来已经进行了多次进化如果可用,请尝试只使用一个步骤:
git clone -b 'v1.17.1' --recurse-submodule --depth 1 https://github.com/grpc/grpc