Search code examples
gitclonestdoutstderrtee

git clone writes to sderr, fine but why can't I redirect to stdout


I figured that git clone uses STDERR.

I now want to redirect it to STDOUT to use this hack.

I'm having some issues (also, I use great stderred library to color STDERR red automatically).

You can see the problems in the attached image, doesn't make much sense to me... please clarify why this is happening and how to get all output to STDERR so I can use tee properly.

enter image description here


Solution

  • Like many Unix utilities, git-clone will be quieter if it's redirected to a pipe. The assumption is the output is useful to a human and it will just get in the way of a program. tee breaks this assumption, but git can't know what's at the end of the pipe.

    From the git-clone manual...

    --progress

    Progress status is reported on the standard error stream by default when it is attached to a terminal, unless -q is specified. This flag forces progress status even if the standard error stream is not directed to a terminal.

    You have to specify git clone --progress to force it to do the full output.