git Git克隆详细输出?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26056130/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 02:32:51  来源:igfitidea点击:

Git clone verbose output?

gitgit-clonedocker-buildverbose

提问by Aleksei Petrenko

I have to clone a couple of big repos in my Dockerfile. It really can take an hour to clone a single repo and I want to see standard Git progress output to understand what's going on.

我必须在我的 Dockerfile 中克隆几个大的存储库。克隆单个 repo 确实需要一个小时,我想查看标准 Git 进度输出以了解发生了什么。

However, when Git is started from the Dockerfile, I see no git clone output whatsoever. The only thing printed to console is:

但是,当从 Dockerfile 启动 Git 时,我看不到任何 git clone 输出。打印到控制台的唯一内容是:

Cloning into '/root/lib/opencv'...
POST git-upload-pack (gzip 2052 to 1062 bytes)

and then just a silence. While, usually, I expect something like this:

然后只是一片沉默。虽然,通常,我期待这样的事情:

Cloning into 'opencv'...
POST git-upload-pack (gzip 2040 to 1052 bytes)
remote: Counting objects: 158365, done.
Receiving objects:   8% (12670/158365), 2.32 MiB | 255.00 KiB/s
... and so on ...

How to enable git verbose output in docker build? Maybe I have to start some interactive mode?

如何在 docker build 中启用 git 详细输出?也许我必须启动一些交互模式?

回答by Sergey P. aka azure

As far as I undestand it's not the issue of the Docker, but issue of the git. By default git shows progress if you are in an interactive console. If you are not you could specify additional paremeters to git cloneto output progress to stdout:

据我所知,这不是 Docker 的问题,而是git. 默认情况下,如果您在交互式控制台中,git 会显示进度。如果不是,您可以指定其他参数以git clone将进度输出到标准输出:

git clone --progress --verbose .....