Suppress ssh banner on git operations

For normal ssh login to a gitlab server the sshd_config causes /etc/ to be displayed with the Banner option. This is desirable.

However when a git operation (such as clone, push, or pull) that contacts the server and uses ssh as the git user the banner also appears. In many circumstances such as git being part of pipelines and interacting with jenkins or other environments, the git operations are automated. The banner displayed in this case is useless (no one is reading it), fills up log files, and in some cases, breaks workflow.

Is there any way to disable the banner for git operations?

In the authorized_keys file for the git user the command is set to:
command="/opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-shell key-1" so it is not per se feasible to change that.

Is there any other known option or solution to this configuration?



1 Like

Try adding these lines to the bottom of /etc/ssh/sshd_config:

Match User git
    Banner none
1 Like

Thank you. Yes. Of course. The simple obvious solution.