【问题标题】:How to make that git push origin master dont show output of files in repo如何使 git push origin master 不显示 repo 中的文件输出
【发布时间】:2017-12-13 04:21:43
【问题描述】:

我正在尝试 git push 不显示输出。

我尝试使用--quiet 选项并像这样重定向到/dev/null

git push origin master &>/dev/null

但是当像这样进行推送时,Git 仍然会显示 repo 的所有文件:

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
....

我怎样才能让git push 不在终端上的 repo 中显示所有文件?

【问题讨论】:

  • git push origin master 2>/dev/null

标签: git


【解决方案1】:

正如我explained here,大多数git 命令在stderr 上输出,而不是stdout

stderr 只是信息性消息,不被机器消费。

正如评论所说,这意味着您需要将 stderr 重定向到 /dev/null:2>

然而,OP 满足以下条件:

  • &> 应该将 both 输出重定向到 /dev/null
  • [It] 是我的错误,我在生成输出的 shell 脚本中没有看到 tar czvf

【讨论】:

  • 我试过 2> 但这不起作用。 &> 重定向标准输出和标准错误。
  • @n0z 同意,但您是否尝试仅重定向 stderr? (如果 &> 在您的上下文中没有得到很好的支持)
  • @n0z 你使用的是什么 Git 版本,在哪个操作系统上?
  • 我忘了提到它在 linux 的 shell 脚本中:S
  • @n0z 仍然对 Git 版本感兴趣。以防万一,> /dev/null 2>& 会更好吗?
猜你喜欢
  • 2023-04-01
  • 2014-04-30
  • 1970-01-01
  • 2021-04-13
  • 2021-07-14
  • 2015-12-08
  • 2017-09-21
  • 2012-09-09
  • 2012-04-21
相关资源
最近更新 更多