美文网首页
GitHub使用(ing。。。)

GitHub使用(ing。。。)

作者: Thor_果冻 | 来源:发表于2018-12-31 12:55 被阅读0次

git官方文档 pro git

GitHub初始配置

  1. 设置git试用的姓名和邮箱地址。
git config --global user.name "dongdong wu"
git config --global user.email "745661590@qq.com"
cat .gitconfig 
//会显示
 [user]
  name = dongdong wu
  email = 745661590@qq.com

  1. 提高代码可读性(暂时没体验到用处)

        git config --global color.ui auto
        cat .gitconfig 
        //会显示
        [color]
         ui = auto
    
  2. 创建GitHub用户

    • 就可以得到公开界面的URL:https://github.com/Thor-jelly

    • 设置一个头像

    • 设置SSH Key 官网介绍地址

      • 创建SSH Key
          ssh-keygen -t rsa -C "745661590@qq.com" 
          Generating public/private rsa key pair.
          //输入文件名称,可以直接回车键
          Enter file in which to save the key (/Users/shandian/.ssh/id_rsa): 
          Created directory '/Users/shandian/.ssh'.
          //输入密码
          Enter passphrase (empty for no passphrase): 
          //再次输入密码
          Enter same passphrase again: 
          Your identification has been saved in /Users/shandian/.ssh/id_rsa.
          Your public key has been saved in /Users/shandian/.ssh/id_rsa.pub.
          The key fingerprint is:
          //会得到--fingerprint值 和 你输的邮箱
          fingerprint值 745661590@qq.com
          The key's randomart image is:
          +---[RSA 2048]----+
          |                 |
          |                 |
      

      这样就会创建了SSH Key,其中id_rsa是私有秘钥,id_rsa.pub是公开秘钥
      查看公共秘钥中的内容

          cat ~/.ssh/id_rsa.pub
          //会得到
          公开秘钥内容 745661590@qq.com
      
      • 添加公开秘钥
        • 进入设置界面-->https://github.com/settings/keys

        • 点击 new ssh key 按钮进行添加key,设置key 名称和key。

          image
          如果添加成功了,你就会收到一份邮件:公共秘钥添加成功
        • 完成上述设置后,就可以用私人秘钥与GitHub进行认证和通信了。

          ssh -T git@github.com
          The authenticity of host 'github.com (192.30.255.112)' can't be established.
          RSA key fingerprint is `fingerprint值`
          Are you sure you want to continue connecting (yes/no)? //输入yes
          Warning: Permanently added 'github.com,192.30.255.112' (RSA) to the list of known hosts.
          Enter passphrase for key '/Users/shandian/.ssh/id_rsa': //输入密码
          //出现下面提示表明成功
          Hi Thor-jelly! You've successfully authenticated, but GitHub does not provide shell access.
          

仓库

  1. 创建--》点击工具栏-new repository

    image
    全部填写好,点击create repository
  2. 复制项目URL:git@github.com:Thor-jelly/Test.git

在git中clone项目有两种方式:HTTPS和SSH,它们的区别如下:

  • HTTPS:不管是谁,拿到url随便clone,但是在push的时候需要验证用户名和密码;
  • SSH:clone的项目你必须是拥有者或者管理员,而且需要在clone前添加SSH Key。
  • SSH 在push的时候,是不需要输入用户名的,如果配置SSH key的时候设置了密码,则需要输入密码的,否则直接是不需要输入密码的。
  1. clone项目

    git clone git@github.com:Thor-jelly/Test.git
    Cloning into 'Test'...
    remote: Counting objects: 4, done.
    remote: Compressing objects: 100% (3/3), done.
    remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
    Receiving objects: 100% (4/4), done.
    
  2. 更改README文件内容

    # Test
        测试使用GitHub
        
    ## 我的第一次提交到GitHub
    
  3. 提交代码

    • 先查看当前状态
      git status
    • 提交
    git add 当前文件名                    //把文件添加到暂存区
    git commit -m "first commit"  //再通过改命令进行提交
    
    • 查看提交日志
    git log
    
    • 提交到仓库
    git push
    

相关文章

  • GitHub使用(ing。。。)

    git官方文档 pro git GitHub初始配置 设置git试用的姓名和邮箱地址。 提高代码可读性(暂时没体验...

  • Github Page 搜索工具

    轮子 今天造了一个轮子 -- Github Page搜索工具 https://man-ing.com/github...

  • 英语文法—ing格式的分类和判定方法(带词源的讲解)

    I. ing格式的数量——ing格式用法给使用带来某些困难,其原因是,实际使用中,至少有4种词汇以ing结尾,而每...

  • Github

    Github使用教程一Github使用教程二Github使用教程三 Git常用命令Git之使用GitHub搭建远程仓库

  • 【GitHub】GitHub的使用

    基本指令 配置自己的身份:git config -- global user.name "Tony"设置自己的名字...

  • 使用GitHub(三):使用VSCode+GitHub进行版本控

    使用GitHub(三):使用VSCode+GitHub进行版本控制 本文简单介绍使用VSCode+GitHub进行...

  • GITHUB使用

    经典 使用中出现了两个问题:1.创建完公钥和私钥放到github上之后用ssh -T git@github.com...

  • 使用github

    目的:借助github托管项目代码 1、使用github(目的、基本概念、注册账号) 仓库(Repository)...

  • 使用GitHub

    之前学过怎么去运用github,但一直以来都是懵懵懂懂地去用,现在想自己编写一个教程来帮助自己记忆这个github...

  • github使用

    下载完成git后 使用git config --global user.name "Your Name"git c...

网友评论

      本文标题:GitHub使用(ing。。。)

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