zoukankan      html  css  js  c++  java
  • git版本管理之git-ssh 配置和使用

    1.设置用户名和邮箱
     $ git config --global user.name "gsx-gh"
     $ git config --global user.email "gsx@126.com"

    2.生成密钥

    $ ssh-keygen -t rsa -C "gsx@126.com"
    Generating public/private rsa key pair.
    Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa):
    Created directory '/c/Users/Administrator/.ssh'.
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /c/Users/Administrator/.ssh/id_rsa.
    Your public key has been saved in /c/Users/Administrator/.ssh/id_rsa.pub.
    The key fingerprint is:
    SHA256:XwstvBad8mew3XT+IRSPV9+EZEL6WNEje+dW/qzAGFo gsx@126.com
    The key's randomart image is:
    +---[RSA 2048]----+
    |           .+.o  |
    |           ..=o. |
    |          . .+..o|
    |         . *..=.*|
    |        S E B+ **|
    |         + %.=.+=|
    |        . = *.+++|
    |         .   +. =|
    |              ...|
    +----[SHA256]-----+

    3.复制/c/Users/Administrator/.ssh/id_rsa.pub中生成的内容,登陆github账号添加ssh-key

    title自定义

    将公钥添加到key中,点击ADD保存

    4.测试

      

    $ ssh -T git@github.com
    The authenticity of host 'github.com (192.30.253.112)' can't be established.
    RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
    Hi gsx! You've successfully authenticated, but GitHub does not provide shell access.

    出现以上信息,则设置成功,可以使用ssh访问提交代码。

    ps:以上命令在gitbash软件命令行执行。安装git

  • 相关阅读:
    Java代码:response压缩响应
    SpringBoot框架:第一章:基础配置和介绍
    asp.net 发送email
    .NET环境下水晶报表使用总结
    ASP.net(c#)生成条形码
    表格操作类(添加,删除,排序,上移,下移)
    NET email
    C#如何打印条形码EAN13码
    在asp.net中备份还原SQL Server数据库
    配置SQL2000数据库发送邮件
  • 原文地址:https://www.cnblogs.com/sagech/p/5719943.html
Copyright © 2011-2022 走看看