• [Git & GitHub] 利用Git Bash进行第一次提交文件


    转载:https://blog.csdn.net/dietime1943/article/details/72420042

    利用Git Bash进行第一次提交文件

    快下班的时候,MD群里有人问怎么向github上提交文件,下面进行简单的介绍:

    (1) GitHub中创建一个工程

    仓库的https地址:https://github.com/bluetata/blog.csdn.dietime1943.git

    GitHub上创建仓库后生成的提示

    Create a new repository on the command line :

    touch README.md
    git init
    git add README.md
    git commit -m "first commit"
    git remote add origin https://github.com/bluetata/blog.csdn.dietime1943.git
    git push -u origin master

    Push an existing repository from the command line :

    git remote add origin https://github.com/bluetata/blog.csdn.dietime1943.git
    git push -u origin master

    (2) 初始化git目录

    $ cd D:/001_workspaces/098_Github
    $ git init

    如果不执行这条命令, 就会出现错误 :fatal: Not a git repository (or any of the parent directories): .git

    (3) 追加文件到缓存

    $ git add -A// 表示将所有的已跟踪的文件的修改与删除和新增的未跟踪的文件都添加到暂存区

    (4) 进行commit提交

    $ git commit -m "commit test"

    如果第一次进行提交会出现如下提示信息:

    bluetata@IBM012-PC06874UMINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)
    $ git commit -m "commit test"

    *** Please tell me who you are.

    Run

      git config --global user.email "you@example.com"
      git config --global user.name "Your Name"

    to set your account's default identity.
    Omit --global to set the identity only in this repository.

    fatal: unable to auto-detect email address (got 'bluetata@IBM012-PC06874U.(none)')

    根据提示按照如下输入即可(输入完后会弹出github登录的pop提示框):

    bluetata@IBM012-PC06874UMINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)
    $ git config --global user.email "dietime1943@hotmail.com"

    bluetata@IBM012-PC06874UMINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)
    $ git config --global user.name "bluetata"

    (5) Push到远程仓库(提交到github服务器中)

    $ git push -u origin master

    最后:附上完整的操作记录:

        bluetata@IBM012-PC06874U MINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)  
        $ ll  
        total 13  
        -rw-r--r-- 1 bluetata 197121 2263 Feb 17 11:03 'add user library to project in eclipse.md'  
        drwxr-xr-x 1 bluetata 197121    0 May 11 16:18  article/  
        drwxr-xr-x 1 bluetata 197121    0 Mar 29 22:10  interviews/  
        drwxr-xr-x 1 bluetata 197121    0 Mar 29 22:10  jsoup/  
        drwxr-xr-x 1 bluetata 197121    0 Mar 29 22:10  maven/  
        -rw-r--r-- 1 bluetata 197121   73 Mar 28 19:02  README.md  
        -rw-r--r-- 1 bluetata 197121 2154 Feb  8 10:06 'solution of tomcat 404.md'  
          
        bluetata@IBM012-PC06874U MINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)  
        $ git add -A  
          
        bluetata@IBM012-PC06874U MINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)  
        $ git commit -m "commit test"  
          
        *** Please tell me who you are.  
          
        Run  
          
          git config --global user.email "you@example.com"  
          git config --global user.name "Your Name"  
          
        to set your account's default identity.  
        Omit --global to set the identity only in this repository.  
          
        fatal: unable to auto-detect email address (got 'bluetata@IBM012-PC06874U.(none)')  
          
        bluetata@IBM012-PC06874U MINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)  
        $ git config --global user.email "dietime1943@hotmail.com"  
          
        bluetata@IBM012-PC06874U MINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)  
        $ git config --global user.name "bluetata"  
          
        bluetata@IBM012-PC06874U MINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)  
        $ git add -A  
          
        bluetata@IBM012-PC06874U MINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)  
        $ git commit -m "commit test"  
        [master f6d6241] commit test  
         6 files changed, 6 insertions(+), 96 deletions(-)  
         create mode 100644 .tags1  
         delete mode 100644 Jsoup01.html  
         delete mode 100644 Jsoup01.md  
         delete mode 100644 Jsoup02.md  
         create mode 100644 article/CSDN link problems.md  
         rename "maven/ 343200220350207252345255246maven347263273345210227343200221345210233345273272simple project.md" => "maven/343200220350207252345255246maven347263273345210227343200221345210233345273272simple project.md" (100%)  
          
        bluetata@IBM012-PC06874U MINGW64 /d/001_workspaces/098_Github/blog.csdn.dietime1943 (master)  
        $ git push -u origin master  
        Counting objects: 6, done.  
        Delta compression using up to 4 threads.  
        Compressing objects: 100% (5/5), done.  
        Writing objects: 100% (6/6), 678 bytes | 0 bytes/s, done.  
        Total 6 (delta 3), reused 0 (delta 0)  
        remote: Resolving deltas: 100% (3/3), completed with 3 local objects.  
        To https://github.com/bluetata/blog.csdn.dietime1943.git  
           99590f3..f6d6241  master -> master  
        Branch master set up to track remote branch master from origin.  

    注:本文原创由`bluetata`发布于blog.csdn.net、转载请务必注明出处。

  • 相关阅读:
    阿里云快速搭建Node.js开发环境
    初始化阿里云服务器
    docker上安装tomcat
    阿里云搭建支付宝小程序
    阿里云docker上安装redis
    WARN o.a.c.c.AprLifecycleListener [log,175] The Apache Tomcat Native library failed to load. The error reported was [no tcnative1 in java.library.path:
    阿里云快速搭建网站
    云服务器(CentOS系统)完全卸载mysql
    wumeismart编译运行和部署系统
    阿里云ssh关闭,保持jar程序运行
  • 原文地址:https://www.cnblogs.com/Java-Starter/p/9158702.html
Copyright © 2020-2023  润新知