2

I'm trying that git push don't show the output.

I try with --quiet option and redirection to /dev/null like that:

git push origin master &>/dev/null

But Git still shows all files of the repo when a make a push like that:

Username for 'https://github.com': n0zg
Password for 'https://n0zg@github.com': 
test.html
888.html
9991.html
999.html
index.html
css/
css/stylesheet.css
highlight/
highlight/README.md
highlight/LICENSE
highlight/CHANGES.md
highlight/README.ru.md
highlight/styles/
highlight/styles/ir-black.css
....

How can I make that git push don't show all files in the repo on the terminal?

n0z
  • 45
  • 6

1 Answers1

1

As I explained here, most of the git commands do their output on stderr, not stdout.

stderr is just informative messages, not to be consumed by machines.

That means, as commented, that you need to redirect stderr to /dev/null: 2>

The OP however comments that:

  • &> should have redirect both outputs to /dev/null
  • [It] was an error of mine, I didn't see a tar czvf that I have in the shell script that was generate the output.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I tried 2> but that does not work. &> rediect both stdout and stderr. – n0z Jul 09 '17 at 10:06
  • @n0z Agreed, but did you try to redirect just stderr? (in case the &> is not well supported in your context) – VonC Jul 09 '17 at 10:09
  • @n0z What Git version are you using, on which OS? – VonC Jul 09 '17 at 10:11
  • I forget mention that is inside a shell script in linux :S – n0z Jul 09 '17 at 10:11
  • @n0z Still interested ion the Git version. Just in case, would `> /dev/null 2>&` work better? – VonC Jul 09 '17 at 10:13
  • Git version is 2.13.2 and SO arch linux – n0z Jul 09 '17 at 10:14
  • @n0z "I forget mention that is inside a shell script in linux": would the same `&>` redirection work when executed directly from the command line instead of from a script. – VonC Jul 09 '17 at 16:27
  • I have to apologize, was a error of mine, i didn't see a `tar czvf` that i have in the shell script that was generate the output. T.T – n0z Jul 11 '17 at 10:24
  • @n0z Thank you for this feedback: I have included it in the answer, for more visibility (and to help others). I have also included the `&>` syntax. – VonC Jul 11 '17 at 17:00