Problem Description
Today, while using Git Push in VS Code, the following error suddenly appeared:
1 | > git push origin master:master |
Cause Analysis
After investigation, the issue was traced to the ~/.ssh/config configuration file.
Previously, when I used the Add New SSH Host feature built into the VS Code Remote-SSH plugin to add a remote host, the plugin automatically rewrote the SSH configuration file, causing the spaces between some configuration items and their end-of-line comments to be lost.
The error is as follows:
The original configuration looked like this:
1 | Host * |
After using the SSH plugin to add a host, the plugin automatically rewrote the .ssh/config file, and after processing it became the following format:
1 | Host * |
Because the parameter values are directly connected to #, OpenSSH cannot correctly parse the configuration items, which causes SSH initialization to fail, thereby affecting Git Push, and the SSH plugin also becomes unusable.