GitHub-使用SSH进行无密码身份验证

New to Git or GitHub? For a deeper understanding check out GitHub’s explanation.

Git或GitHub的新手? 要获得更深入的了解,请查看GitHub的说明

什么是SSH? (What is SSH?)

SSH (Secure Shell) protocol is a software package that enables secure system administration and file transfers over insecure networks. SSH protocols use encryption to secure the connection between client and server. All user authentication, commands, output, and file transfers are encrypted to protect against attacks.

SSH(安全外壳)协议是一个软件包,可以通过不安全的网络进行安全的系统管理和文件传输。 SSH协议使用加密来保护客户端和服务器之间的连接。 所有用户身份验证,命令,输出和文件传输都经过加密,以防止受到攻击。

为什么要使用SSH密钥? (Why use an SSH key?)

When working with a GitHub repository, you’ll often need to identify yourself to GitHub using your username and password. An SSH key is an alternate way to identify yourself that doesn’t require you to provide your credentials every time.

使用GitHub存储库时,通常需要使用用户名和密码在GitHub上标识自己。 SSH密钥是另一种标识自己的身份,不需要您每次都提供凭据。

SSH keys come in pairs, a public key that gets shared with services like GitHub, and a private key that is stored only on your computer. If the keys match, you’re granted access.

SSH密钥成对出现,与GitHub等服务共享的公用密钥和仅存储在您的计算机上的专用密钥 。 如果密钥匹配,则将授予您访问权限。

Note: you should never share your private key

注意:永远不要共享您的私钥

The encryption behind SSH keys ensures that no one can derive your private key from the public one.

SSH密钥背后的加密确保了没有人可以从公共密钥中派生您的私有密钥。

逐步SSH设置说明 (Step by step SSH setup instructions)

  • Create a GitHub account.

    创建一个GitHub帐户。

  • Download and install git.

    下载并安装git

  • Set up git with your user name and email, Open a terminal/shell and type:

    使用您的用户名和电子邮件设置git,打开终端/外壳并键入:
$ git config --global user.name "Your name here"
$ git config --global user.email "your_email@example.com"
  • Set up SSH on your computer for password-less logins. The first step in using SSH authorization with GitHub is to generate your SSH key pair.

    在计算机上设置SSH以进行无密码登录。 在GitHub中使用SSH授权的第一步是生成SSH密钥对。
  • You might already have an SSH key pair on your machine. Look to see if you have any files under~/.ssh/id_rsa and ~/.ssh/id_rsa.pub. If you see, you already have a key pair and don't need to create a new one.

    您的计算机上可能已经有一个SSH密钥对。 查看是否在~/.ssh/id_rsa~/.ssh/id_rsa.pub下有任何文件。 如果看到的话,您已经有了一个密钥对,不需要创建一个新的密钥对。

  • Generate SSH key using$ ssh-keygen -t rsa -C "your_email@example.com"

    使用$ ssh-keygen -t rsa -C "your_email@example.com"生成SSH密钥

When asked where to save the new key, hit enter to accept the default location.

当系统询问您将新密钥保存在何处时,请按Enter键以接受默认位置。

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/username/.ssh/id_rsa):

Next, add your public key to your Github profile. Now you should be able to push to Github without entering your username or password.

接下来,将您的公钥添加到您的Github个人资料中 。 现在,您无需输入用户名或密码就可以推送到Github。

翻译自: https://medium.com/frontend-digest/github-password-less-authentication-ssh-3b4f90fb8de3

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值