When working with Git over SSH on Windows, it is important to disable the Message of the Day (MOTD) feature. The MOTD is a message that is displayed when a user connects to a server over SSH. It is used to inform users about new software or server updates, or to display a disclaimer.
Unfortunately, on Windows, the MOTD can cause a delay when using Git over SSH. This is because Windows’ native SSH client (OpenSSH) will wait for the MOTD to finish before sending the user’s SSH key. This can cause a noticeable lag when authenticating with a remote repository.
Fortunately, it is possible to disable the MOTD in Windows by editing the sshd_config file. This file is located at “C:\\ProgramData\\ssh\\sshd_config”. Open the file in a text editor, locate the line “PrintMotd yes”, and set it to “PrintMotd no”. Save the file and restart the sshd service.
You can also disable the MOTD by using the command line. Open an elevated command prompt and run the following command: “sc config sshd start= disabled”. This will disable the sshd service and prevent the MOTD from being displayed.
Alternatively, you can use the Registry Editor to disable the MOTD. Open the Registry Editor, navigate to “HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\sshd”, locate the “Start” key, and set it to “4” (disabled).
Disabling the MOTD in Windows can greatly improve the performance of Git over SSH. However, it is important to note that the MOTD can still be displayed if the server you are connecting to is configured to do so.
In addition, disabling the MOTD may cause other SSH-related services, such as SFTP and SCP, to stop working. If this occurs, you can re-enable the MOTD by setting the “PrintMotd” key to “yes” in the sshd_config file, or by setting the “Start” key to “2” in the Registry Editor.
In summary, disabling the MOTD in Windows can improve the performance of Git over SSH. This can be done by editing the sshd_config file, using the command line, or using the Registry Editor. However, it is important to note that this may cause other SSH-related services to stop working.