美文网首页
1.使用GitHub的前期准备

1.使用GitHub的前期准备

作者: LinuxLeeSinYY | 来源:发表于2018-05-16 21:07 被阅读0次
    • 新建GitHub账号

    • 设置姓名和邮箱

        git config --global user.name "YourGitHubName"
        git config --global user.email "YourGitHubEmail"
      

    这个命令,会在“ ~/.gitconfig”中以如下形式输出设置文件

        [user]
            name = YourGitHubName
            email = YourGitHubEmail
    
    • 设置SSH

        ssh-keygen -t rsa -C "your_email@example.com"
      

    之后会生成两个文件,id_rsa 文件是私有密钥, id_rsa.pub 是公开密钥

    • 添加公开密钥

    点击右上角的账户设定按钮(Account Settings),选择 SSH Keys 菜单。点击 Add SSH Key 之后,在 Title 中输入适当的密钥名称。 Key 部分请粘贴 id_rsa.pub 文件里的内容。id_rsa.pub的内容可以用如下方法查看

    cat ~/.ssh/id_rsa.pub
    ssh-rsa 公开密钥的内容 your_email@example.com
    

    完成以上设置后,就可以用手中的私人密钥与 GitHub 进行认证和通信了。让我们来实际试一试。

    ssh -T git@github.com
    The authenticity of host 'github.com (207.97.227.239)' can't be established.
    RSA key fingerprint is fingerprint值 .
    Are you sure you want to continue connecting (yes/no)? 输入yes
    

    出现如下结果即为成功

    Hi hirocastest! You've successfully authenticated,but GitHub does not provide shell acces
    

    相关文章

      网友评论

          本文标题:1.使用GitHub的前期准备

          本文链接:https://www.haomeiwen.com/subject/rsvmdftx.html