Note: GitHub is improving security by dropping older, insecure key types.
DSA keys (ssh-dss
) are no longer supported. Existing keys will continue to function through March 15, 2022. You cannot add new DSA keys to your user account on GitHub Enterprise Server.
RSA keys (ssh-rsa
) with a valid_after
before November 2, 2021 may continue to use any signature algorithm. RSA keys generated after that date must use a SHA-2 signature algorithm. Some older clients may need to be upgraded in order to use SHA-2 signatures.
-
打开 Terminal(终端)Terminal(终端)Git Bash。
-
输入
ls -al ~/.ssh
以查看是否存在现有 SSH 密钥:$ ls -al ~/.ssh # Lists the files in your .ssh directory, if they exist
-
检查目录列表以查看是否已经有 SSH 公钥。 默认情况下,公钥的文件名是以下之一:
- id_rsa.pub
- id_ecdsa.pub
- id_ed25519.pub
如果您没有现有的公钥和私钥对,或者不想使用任何可用于连接到 GitHub Enterprise Server 的密钥对,则生成新的 SSH 密钥。
如果您看到列出的现有公钥和私钥对(例如 id_rsa.pub 和 id_rsa),并且您希望使用它们连接到 GitHub Enterprise Server,则可以将 SSH 密钥添加到 ssh-agent。
提示:如果您收到错误“~/.ssh 不存在”,不要担心! 我们在生成新的 SSH 密钥时会创建它。