NOTE

1.5 SSH

SSH keys, proxies, and Windows/MSYS2 configuration.

Developer ToolsCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

1. Install a Network Proxy Tool

This section is needed only when the network environment actually requires SSH to pass through a proxy.

1.1. Linux

1.1.1. ArchLinux

The original note used connect as the ProxyCommand tool. Whether to install connect, nc, or another proxy tool now depends on the distribution and proxy type. Prefer OpenSSH capabilities already provided by the system or maintained proxy tools.

1.2. Windows

1.2.1. MinGW

The old note installed connect separately through MinGW. If Windows OpenSSH, Git for Windows, or MSYS2 is already in use, there is usually no need to install an old version of MinGW solely for SSH.

1.2.2. MSYS2

msys2.md

2. Configure SSH

2.1. Generate a Key

For modern GitHub SSH configuration, prefer Ed25519:

ssh-keygen -t ed25519 -C "<EMAIL>"

If the target system does not support Ed25519, choose RSA according to compatibility requirements.

2.2. Configure an SSH Proxy

Edit ~/.ssh/config. Using GitHub as an example:

Host github.com
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_ed25519

Host *
    ServerAliveInterval 180

GitHub’s SSH user is git, not your personal GitHub username.

If a proxy is required, add ProxyCommand or ProxyJump according to the specific network environment. Proxy addresses, ports, and internal hosts are machine-environment configuration and should not be hard-coded in public notes.

On Windows, if MSYS2 needs to reuse the .ssh directory in the Windows user directory, create a symbolic link using the actual username in the path:

ln -s /c/Users/<USER>/.ssh "$HOME/.ssh"

If $HOME/.ssh already exists, do not overwrite it directly.

Discussion

Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub