How to redirect the full output of `git clone` to a file?

When I run git clone, as usual, I see the following:

$ git clone https://github.com/bensmithett/webpack-css-example
Cloning into 'webpack-css-example'...
remote: Counting objects: 179, done.
remote: Total 179 (delta 0), reused 0 (delta 0), pack-reused 179
Receiving objects: 100% (179/179), 24.07 KiB | 0 bytes/s, done.
Resolving deltas: 100% (79/79), done.
Checking connectivity... done

However, when I try to redirect this to a file, I only see this:

Cloning into 'webpack-css-example'...

Here is what I tried:

$ git clone https://github.com/bensmithett/webpack-css-example 2>&1 | tee out.log
$ cat out.log
Cloning into 'sample-data'...

I tried it in Node.js and it does the same:

const fs = require('fs');
const child = spawn('git clone https://github.com/bensmithett/webpack-css-example');
child.stdout.on('data', function(data){
  console.log(String(data));
});
child.stderr.on('data', function(data){
  console.log(String(data));
});
// Cloning into 'webpack-css-example'...

Why are all tags remote:, etc. don't get into stdin / stderr? Is there a way to capture output? If not, what happens, what concludes that the output is displayed in the terminal, but it does not go through stdout or stderr?

+4
source share
1 answer

Git , . , . , , --progress, , .

git clone --progress https://github.com/foo/bar 2> out.log

: man git-clone

--progress

, , -q. , .


- , , isatty() true (. man isatty). Git .

+7

All Articles