「之岙」

「之岙」

如何为Github添加ssh

前置#

Ensure that the terminal can use the git and ssh-keygen commands normally.

检查系统内是否已经有 ssh 密钥#

For Linux and MacOS terminals:

ls ~/.ssh
git 全局配置#
git config --global user.name YourUsername

Example: git config --global user.name zhiao

git config --global user.email YourEmail

Example: git config --global user.email [email protected]

生成秘钥#
ssh-keygen -t rsa -C 'TheEmailYouConfiguredInGitAbove'

Example: ssh-keygen -t rsa -C '[email protected]'

将公钥粘贴进 Github#

github->Profile Avatar at the top right corner->Settings->SSH and GPG keys->New SSH key

  1. Enter a Title
  2. Go to the ~/.ssh directory in the terminal, copy the content of the file ending with .pub, and paste it into the Key field
  3. Add SSH key
加载中...
此文章数据所有权由区块链加密技术和智能合约保障仅归创作者所有。